From 56f950a030babc2a1791ace8af50bacdf02d9eae Mon Sep 17 00:00:00 2001 From: n00mkrad Date: Tue, 3 May 2022 16:00:55 +0200 Subject: [PATCH] Do not allow UNC paths for compat reasons, show warnings --- Code/Main/Interpolate.cs | 2 +- Code/Main/InterpolateSteps.cs | 2 +- Code/Main/InterpolateUtils.cs | 16 +++++++++++++++- Code/Ui/UiUtils.cs | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Code/Main/Interpolate.cs b/Code/Main/Interpolate.cs index 0577bd0..e75719d 100644 --- a/Code/Main/Interpolate.cs +++ b/Code/Main/Interpolate.cs @@ -36,7 +36,7 @@ namespace Flowframes canceled = false; Program.initialRun = false; Program.mainForm.SetWorking(true); - if (!Utils.InputIsValid(current.inPath, current.outPath, current.inFps, current.interpFactor, current.outMode)) return; // General input checks + if (!Utils.InputIsValid(current.inPath, current.outPath, current.inFps, current.interpFactor, current.outMode, current.tempFolder)) return; // General input checks if (!Utils.CheckAiAvailable(current.ai, current.model)) return; // Check if selected AI pkg is installed if (!AutoEncodeResume.resumeNextRun && !Utils.CheckDeleteOldTempFolder()) return; // Try to delete temp folder if an old one exists if (!Utils.CheckPathValid(current.inPath)) return; // Check if input path/file is valid diff --git a/Code/Main/InterpolateSteps.cs b/Code/Main/InterpolateSteps.cs index 7aa559d..098054e 100644 --- a/Code/Main/InterpolateSteps.cs +++ b/Code/Main/InterpolateSteps.cs @@ -34,7 +34,7 @@ namespace Flowframes.Main current.RefreshAlpha(); current.stepByStep = true; - if (!InterpolateUtils.InputIsValid(current.inPath, current.outPath, current.inFps, current.interpFactor, current.outMode)) return; // General input checks + if (!InterpolateUtils.InputIsValid(current.inPath, current.outPath, current.inFps, current.interpFactor, current.outMode, current.tempFolder)) return; // General input checks if (!InterpolateUtils.CheckPathValid(current.inPath)) return; // Check if input path/file is valid if (step.Contains("Extract Frames")) diff --git a/Code/Main/InterpolateUtils.cs b/Code/Main/InterpolateUtils.cs index 34e3a33..4211fc0 100644 --- a/Code/Main/InterpolateUtils.cs +++ b/Code/Main/InterpolateUtils.cs @@ -87,6 +87,7 @@ namespace Flowframes.Main if (Config.GetInt(Config.Key.tempFolderLoc) == 4) { string custPath = Config.Get(Config.Key.tempDirCustom); + if (IoUtils.IsDirValid(custPath)) basePath = custPath; } @@ -94,7 +95,7 @@ namespace Flowframes.Main return Path.Combine(basePath, Path.GetFileNameWithoutExtension(inPath).StripBadChars().Remove(" ").Trunc(30, false) + "-temp"); } - public static bool InputIsValid(string inDir, string outDir, Fraction fpsIn, float factor, I.OutMode outMode) + public static bool InputIsValid(string inDir, string outDir, Fraction fpsIn, float factor, I.OutMode outMode, string tempFolder) { try { @@ -114,6 +115,12 @@ namespace Flowframes.Main passes = false; } + if (passes && tempFolder.StartsWith(@"\\")) + { + UiUtils.ShowMessageBox("Flowframes does not support UNC/Network paths as a temp folder!\nPlease use a local path instead."); + passes = false; + } + if (passes && fpsOut < 1f || fpsOut > 1000f) { string imgSeqNote = isFile ? "" : "\n\nWhen using an image sequence as input, you always have to specify the frame rate manually."; @@ -188,6 +195,13 @@ namespace Flowframes.Main public static bool CheckPathValid(string path) { + if (path.StartsWith(@"\\")) + { + UiUtils.ShowMessageBox("Input path is not valid.\nFlowframes does not support UNC/Network paths."); + I.Cancel(); + return false; + } + if (IoUtils.IsPathDirectory(path)) { if (!IoUtils.IsDirValid(path)) diff --git a/Code/Ui/UiUtils.cs b/Code/Ui/UiUtils.cs index b12c26c..ab09c1e 100644 --- a/Code/Ui/UiUtils.cs +++ b/Code/Ui/UiUtils.cs @@ -83,7 +83,7 @@ namespace Flowframes.Ui public static DialogResult ShowMessageBox(string text, MessageType type = MessageType.Message) { - Logger.Log($"MessageBox: {text} ({type}){(BatchProcessing.busy ? "[Batch Mode - Will not display messagebox]" : "")}"); + Logger.Log($"MessageBox: {text} ({type}){(BatchProcessing.busy ? "[Batch Mode - Will not display messagebox]" : "")}", true); if (BatchProcessing.busy) return new DialogResult();