|
|
@ -1,4 +1,5 @@ |
|
|
|
using System.IO; |
|
|
|
using System; |
|
|
|
|
|
|
|
using System.IO; |
|
|
|
using NCode.ReparsePoints; |
|
|
|
using NCode.ReparsePoints; |
|
|
|
using NLog; |
|
|
|
using NLog; |
|
|
|
using StabilityMatrix.Extensions; |
|
|
|
using StabilityMatrix.Extensions; |
|
|
@ -11,10 +12,12 @@ public class SharedFolders : ISharedFolders |
|
|
|
{ |
|
|
|
{ |
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); |
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); |
|
|
|
private readonly ISettingsManager settingsManager; |
|
|
|
private readonly ISettingsManager settingsManager; |
|
|
|
|
|
|
|
private readonly IPackageFactory packageFactory; |
|
|
|
|
|
|
|
|
|
|
|
public SharedFolders(ISettingsManager settingsManager) |
|
|
|
public SharedFolders(ISettingsManager settingsManager, IPackageFactory packageFactory) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this.settingsManager = settingsManager; |
|
|
|
this.settingsManager = settingsManager; |
|
|
|
|
|
|
|
this.packageFactory = packageFactory; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void SetupLinksForPackage(BasePackage basePackage, string installPath) |
|
|
|
public void SetupLinksForPackage(BasePackage basePackage, string installPath) |
|
|
@ -108,4 +111,27 @@ public class SharedFolders : ISharedFolders |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void RemoveLinksForAllPackages() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var libraryDir = settingsManager.LibraryDir; |
|
|
|
|
|
|
|
var packages = settingsManager.Settings.InstalledPackages; |
|
|
|
|
|
|
|
foreach (var package in packages) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (package.PackageName == null) continue; |
|
|
|
|
|
|
|
var basePackage = packageFactory.FindPackageByName(package.PackageName); |
|
|
|
|
|
|
|
if (basePackage == null) continue; |
|
|
|
|
|
|
|
if (package.LibraryPath == null) continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
RemoveLinksForPackage(basePackage, Path.Combine(libraryDir, package.LibraryPath)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Logger.Warn("Failed to remove junction links for package {Package} " + |
|
|
|
|
|
|
|
"({DisplayName}): {Message}", package.PackageName, package.DisplayName, e.Message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|