diff --git a/src/NuGetForUnity/Editor/Configuration/NugetConfigFile.cs b/src/NuGetForUnity/Editor/Configuration/NugetConfigFile.cs index cd2cc4c1..43b33c06 100644 --- a/src/NuGetForUnity/Editor/Configuration/NugetConfigFile.cs +++ b/src/NuGetForUnity/Editor/Configuration/NugetConfigFile.cs @@ -107,7 +107,7 @@ public class NugetConfigFile /// while auto-restoring. /// public bool SlimRestore { get; set; } = true; - + /// /// Gets or sets a value indicating whether a package is installed to /Packages/PackagesFolder or /Assets /// @@ -121,7 +121,7 @@ public bool InstallToPackagesFolder UnityPathHelper.InstallToPackagesFolder = value; if (value) { - + var rel = PathHelper.GetRelativePath(Application.dataPath, RepositoryPath); RepositoryPath = Path.Combine(UnityPathHelper.NugetAssetsPath, rel); } @@ -375,6 +375,7 @@ public static NugetConfigFile Load([NotNull] string filePath) configFile.RelativePackagesConfigDirectoryPath = value; } } + return configFile; } @@ -491,7 +492,7 @@ public void Save([NotNull] string filePath) if (!string.IsNullOrEmpty(savedRepositoryPath)) { - + // save the un-expanded repository path addElement = new XElement("add"); addElement.Add(new XAttribute("key", "repositoryPath")); @@ -525,6 +526,7 @@ public void Save([NotNull] string filePath) addElement.Add(new XAttribute("key", "slimRestore")); addElement.Add(new XAttribute("value", SlimRestore.ToString().ToLowerInvariant())); config.Add(addElement); + if (InstallToPackagesFolder) { addElement = new XElement("add"); diff --git a/src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs b/src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs index 5f3dac4c..81b876fc 100644 --- a/src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs +++ b/src/NuGetForUnity/Editor/Helper/UnityPathHelper.cs @@ -4,7 +4,6 @@ using System.IO; using System.Text; using JetBrains.Annotations; -using UnityEditor; using UnityEngine; #region No ReShaper @@ -31,7 +30,7 @@ static UnityPathHelper() AbsoluteAssetsPath = Path.GetFullPath(Application.dataPath); AbsoluteProjectPath = Path.GetDirectoryName(AbsoluteAssetsPath) ?? throw new InvalidOperationException("Can't detect project root."); var packagePath = Path.Combine(AbsoluteProjectPath, "Packages"); - NugetAssetsPath=Path.Combine(packagePath, "NuGetAssets"); + NugetAssetsPath=Path.Combine(packagePath, "NuGetAssets"); } private static bool installToPackagesFolder=false; @@ -57,14 +56,13 @@ internal static bool InstallToPackagesFolder } } /// - /// Gets the path to the InstallPath directory. + /// Gets the path to the ../Package/NuGetAssets directory. /// [NotNull] internal static string NugetAssetsPath { get; } - - + /// - /// Gets the absolute path to the NuGetAssets directory. + /// Gets the absolute path to the Unity-Project 'Assets' directory. /// [NotNull] internal static string AbsoluteAssetsPath { get; } @@ -73,7 +71,7 @@ internal static bool InstallToPackagesFolder /// Gets the absolute path to the Unity-Project root directory. /// [NotNull] - internal static string AbsoluteProjectPath { get; } + internal static string AbsoluteProjectPath { get; } /// /// Checks if given path is within Assets folder. @@ -94,8 +92,7 @@ internal static bool IsPathInAssets([NotNull] string path) [NotNull] private static string GetAssetsRelativePath([NotNull] string path) { - - return PathHelper.GetRelativePath(AbsoluteAssetsPath, path); + return PathHelper.GetRelativePath(Application.dataPath, path); } } } diff --git a/src/NuGetForUnity/Editor/Ui/NugetPreferences.cs b/src/NuGetForUnity/Editor/Ui/NugetPreferences.cs index d7f235c7..b2e73a06 100644 --- a/src/NuGetForUnity/Editor/Ui/NugetPreferences.cs +++ b/src/NuGetForUnity/Editor/Ui/NugetPreferences.cs @@ -513,6 +513,7 @@ public NugetPlugin(string name, string path) [CanBeNull] public Assembly Assembly { get; } + public string Name { get; } public string Path { get; } diff --git a/src/NuGetForUnity/Editor/Ui/NugetWindow.cs b/src/NuGetForUnity/Editor/Ui/NugetWindow.cs index af6ef066..1a3261d5 100644 --- a/src/NuGetForUnity/Editor/Ui/NugetWindow.cs +++ b/src/NuGetForUnity/Editor/Ui/NugetWindow.cs @@ -1056,10 +1056,8 @@ private void DrawUpdatesHeader() /// /// Draws the "Refresh" and "Preferences" buttons in the upper right corner, which are visible in every tab. /// - private void DrawMandatoryButtons() { - if (GUILayout.Button("Refresh", GUILayout.Width(60))) { Refresh(true); @@ -1512,4 +1510,4 @@ private sealed class VersionDropdownData public string[] DropdownOptions { get; set; } } } -} +} \ No newline at end of file