-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ public static class ConfigurationManager | |
static ConfigurationManager() | ||
{ | ||
NugetConfigFileDirectoryPath = UnityPathHelper.AbsoluteAssetsPath; | ||
|
||
Check warning on line 38 in src/NuGetForUnity/Editor/Configuration/ConfigurationManager.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 38 in src/NuGetForUnity/Editor/Configuration/ConfigurationManager.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
|
||
NugetConfigFilePath = Path.Combine(NugetConfigFileDirectoryPath, NugetConfigFile.FileName); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,65 +29,45 @@ static UnityPathHelper() | |
{ | ||
AbsoluteAssetsPath = Path.GetFullPath(Application.dataPath); | ||
AbsoluteProjectPath = Path.GetDirectoryName(AbsoluteAssetsPath) ?? throw new InvalidOperationException("Can't detect project root."); | ||
|
||
|
||
if( installsInPackagesFolder){ | ||
var packagePath = Path.Combine(AbsoluteProjectPath, "Packages"); | ||
var nugetAssetsPath=Path.Combine(packagePath, "NuGetAssets"); | ||
if (!Directory.Exists(nugetAssetsPath)) | ||
{ | ||
Directory.CreateDirectory(nugetAssetsPath); | ||
} | ||
|
||
var packageJsonPath = Path.Combine(nugetAssetsPath, "package.json"); | ||
if (!File.Exists(packageJsonPath)) | ||
File.WriteAllText(packageJsonPath, | ||
@"{ ""name"": ""com.github-glitchenzo.nugetassets"",""version"": ""1.0.0"",""displayName"": ""NuGetAssets"", ""description"": ""NuGetAssets"", ""dependencies"": {}}"); | ||
|
||
AbsoluteAssetsPath = nugetAssetsPath; | ||
} | ||
var packagePath = Path.Combine(AbsoluteProjectPath, "Packages"); | ||
NugetAssetsPath=Path.Combine(packagePath, "NuGetAssets"); | ||
} | ||
|
||
private static bool installsInPackagesFolder=EditorPrefs.GetBool("InstallNuGetInPackagesFolder", false); | ||
internal static bool InstallsInPackagesFolder | ||
private static bool installToPackagesFolder=false; | ||
Check warning on line 36 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 36 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 36 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
|
||
internal static bool InstallToPackagesFolder | ||
Check warning on line 37 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
|
||
{ | ||
get=>installsInPackagesFolder; | ||
get=>installToPackagesFolder; | ||
set | ||
{ | ||
if(installsInPackagesFolder==value)return; | ||
installsInPackagesFolder = value; | ||
EditorPrefs.SetBool("InstallNuGetInPackagesFolder", true); | ||
var packagePath = Path.Combine(AbsoluteProjectPath, "Packages"); | ||
var nugetAssetsPath=Path.Combine(packagePath, "NuGetAssets"); | ||
if(installToPackagesFolder==value)return; | ||
Check warning on line 42 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 42 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 42 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
|
||
installToPackagesFolder = value; | ||
if (value) | ||
{ | ||
if (!Directory.Exists(nugetAssetsPath)) | ||
if (!Directory.Exists(NugetAssetsPath)) | ||
{ | ||
Directory.CreateDirectory(nugetAssetsPath); | ||
Directory.CreateDirectory(NugetAssetsPath); | ||
} | ||
|
||
var packageJsonPath = Path.Combine(nugetAssetsPath, "package.json"); | ||
var packageJsonPath = Path.Combine(NugetAssetsPath, "package.json"); | ||
if (!File.Exists(packageJsonPath)) | ||
File.WriteAllText(packageJsonPath, | ||
@"{ ""name"": ""com.akeit0.nugetassets"",""version"": ""1.0.0"",""displayName"": ""NuGetAssets"", ""description"": ""NuGetAssets"", ""dependencies"": {}}"); | ||
|
||
AbsoluteAssetsPath = nugetAssetsPath; | ||
} | ||
else | ||
{ | ||
AbsoluteAssetsPath = Path.GetFullPath(Application.dataPath); | ||
/*if (Directory.Exists(nugetAssetsPath)) | ||
{ | ||
Directory.Delete(nugetAssetsPath); | ||
}*/ | ||
@"{ ""name"": ""com.github-glitchenzo.nugetassets"",""version"": ""1.0.0"",""displayName"": ""NuGetAssets"", ""description"": ""NuGetAssets"", ""dependencies"": {}}"); | ||
|
||
Check warning on line 55 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
|
||
} | ||
} | ||
} | ||
Check warning on line 58 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 58 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
|
||
/// <summary> | ||
Check warning on line 59 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 59 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 59 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
|
||
/// Gets the absolute path to the Unity-Project 'Assets' directory. | ||
/// Gets the path to the InstallPath directory. | ||
/// </summary> | ||
[NotNull] | ||
internal static string NugetAssetsPath { get; } | ||
|
||
Check warning on line 64 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 64 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
Check warning on line 64 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
|
||
|
||
Check warning on line 65 in src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs GitHub Actions / Pack .NET Core Global Tool (CLI) and PluginAPI
|
||
/// <summary> | ||
/// Gets the absolute path to the NuGetAssets directory. | ||
/// </summary> | ||
[NotNull] | ||
internal static string AbsoluteAssetsPath { get;private set; } | ||
internal static string AbsoluteAssetsPath { get; } | ||
|
||
/// <summary> | ||
/// Gets the absolute path to the Unity-Project root directory. | ||
|