Do not allow UNC paths for compat reasons, show warnings

This commit is contained in:
n00mkrad
2022-05-03 16:00:55 +02:00
parent 9f3fe41022
commit 56f950a030
4 changed files with 18 additions and 4 deletions

View File

@@ -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

View File

@@ -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"))

View File

@@ -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))

View File

@@ -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();