Browse Source

delete junction before recreating

pull/2864/head
Jason Dove 3 months ago
parent
commit
15de5871ac
No known key found for this signature in database
  1. 14
      ErsatzTV.Application/Playouts/Commands/SyncNextPlayoutHandler.cs

14
ErsatzTV.Application/Playouts/Commands/SyncNextPlayoutHandler.cs

@ -49,6 +49,20 @@ public partial class SyncNextPlayoutHandler( @@ -49,6 +49,20 @@ public partial class SyncNextPlayoutHandler(
// re-point symlink/junction to new folder
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
if (Directory.Exists(currentFolder))
{
var dirInfo = new DirectoryInfo(currentFolder);
if (dirInfo.Attributes.HasFlag(FileAttributes.ReparsePoint))
{
dirInfo.Delete();
}
else
{
logger.LogError("Expected junction at {Folder} but found a real directory", currentFolder);
return;
}
}
var stdErrBuffer = new StringBuilder();
CommandResult command = await Cli.Wrap("cmd.exe")
.WithArguments(["/c", "mklink", "/j", "current", versionFolderName])

Loading…
Cancel
Save