8000 Updated symbolic link Utilities by StephenHodgson · Pull Request #687 · XRTK/com.xrtk.core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.

Updated symbolic link Utilities #687

Merged
merged 1 commit into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static string SymbolicLinkSettingsPath
string.IsNullOrEmpty(symbolicLinkSettingsPath))
{
symbolicLinkSettingsPath = AssetDatabase
.FindAssets($"t:{typeof(SymbolicLinkSettings).Name}")
.FindAssets($"t:{nameof(SymbolicLinkSettings)}")
.Select(AssetDatabase.GUIDToAssetPath)
.OrderBy(x => x)
.FirstOrDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ public string TargetRelativePath
public bool IsActive
{
get => isActive;
internal set => isActive = value;
set
{
if (isActive != value)
{
isActive = value;
SymbolicLinker.RunSync(true);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace XRTK.Editor.Utilities.SymbolicLinks
{
[InitializeOnLoad]
internal static class SymbolicLinker
public static class SymbolicLinker
{
/// <summary>
/// Constructor.
Expand Down Expand Up @@ -48,7 +48,7 @@ static SymbolicLinker()
/// <summary>
/// Debug the symbolic linker utility.
/// </summary>
public static bool DebugEnabled
private static bool DebugEnabled
{
get => MixedRealityPreferences.DebugSymbolicInfo;
set => MixedRealityPreferences.DebugSymbolicInfo = value;
Expand Down Expand Up @@ -128,16 +128,10 @@ public static void RunSync(bool forceUpdate = false)
{
if (string.IsNullOrEmpty(link.SourceRelativePath)) { continue; }

bool isValid = false;
var targetAbsolutePath = $"{ProjectRoot}{link.TargetRelativePath}";
var sourceAbsolutePath = $"{ProjectRoot}{link.SourceRelativePath}";

if (link.IsActive)
{
isValid = VerifySymbolicLink(targetAbsolutePath);
}

if (isValid)
if (VerifySymbolicLink(targetAbsolutePath))
{
// If we already have the directory in our project, then skip.
if (link.IsActive) { continue; }
Expand Down Expand Up @@ -202,7 +196,7 @@ public static void RunSync(bool forceUpdate = false)
/// </summary>
/// <param name="sourceAbsolutePath"></param>
/// <param name="targetAbsolutePath"></param>
public static bool AddLink(string sourceAbsolutePath, string targetAbsolutePath)
internal static bool AddLink(string sourceAbsolutePath, string targetAbsolutePath)
{
if (string.IsNullOrEmpty(sourceAbsolutePath) || string.IsNullOrEmpty(targetAbsolutePath))
{
Expand Down Expand Up @@ -256,7 +250,7 @@ public static bool AddLink(string sourceAbsolutePath, string targetAbsolutePath)
/// Disables a symbolic link in the settings.
/// </summary>
/// <param name="targetRelativePath"></param>
public static bool DisableLink(string targetRelativePath)
internal static bool DisableLink(string targetRelativePath)
{
var symbolicLink = Settings.SymbolicLinks.Find(link => link.TargetRelativePath == targetRelativePath);

Expand All @@ -282,7 +276,7 @@ public static bool DisableLink(string targetRelativePath)
/// </summary>
/// <param name="sourceRelativePath"></param>
/// <param name="targetRelativePath"></param>
public static bool RemoveLink(string sourceRelativePath, string targetRelativePath)
internal static bool RemoveLink(string sourceRelativePath, string targetRelativePath)
{
if (!DisableLink(targetRelativePath))
{
Expand Down
0