Fixed issues with custom output path and batch processing

This commit is contained in:
n00mkrad
2021-12-06 12:48:49 +01:00
parent c57fbb92ee
commit 659332dd0f
4 changed files with 26 additions and 5 deletions

View File

@@ -194,9 +194,8 @@ namespace Flowframes
public void LoadBatchEntry(InterpSettings entry)
{
inputTbox.Text = entry.inPath;
outputTbox.Text = entry.outPath;
MainUiFunctions.SetOutPath(inputTbox, entry.outPath);
interpFactorCombox.Text = entry.interpFactor.ToString();
//aiCombox.SelectedIndex = Implementations.networks.IndexOf(entry.ai);
aiCombox.SelectedIndex = Implementations.networks.IndexOf(Implementations.networks.Where(x => x.aiName == entry.ai.aiName).FirstOrDefault());
SetOutMode(entry.outMode);
}

View File

@@ -114,7 +114,7 @@ namespace Flowframes.Main
return false;
}
if (entry.outPath == null || !Directory.Exists(entry.outPath))
if (entry.outPath == null || (!Directory.Exists(entry.outPath) && Config.GetInt("outFolderLoc") != 1))
{
Logger.Log("Queue: Can't process queue entry: Output path is invalid.");
return false;

View File

@@ -26,7 +26,7 @@ namespace Flowframes.Ui
if (Config.GetBool(Config.Key.clearLogOnInput))
Logger.ClearLogBox();
outputTbox.Text = (Config.GetInt("outFolderLoc") == 0) ? inputTbox.Text.Trim().GetParentDir() : Config.Get("custOutDir").Trim();
SetOutPath(inputTbox, inputTbox.Text.Trim().GetParentDir());
Program.lastInputPath = path;
Program.lastInputPathIsSsd = OsUtils.DriveIsSSD(path);
@@ -66,6 +66,28 @@ namespace Flowframes.Ui
}
public static bool SetOutPath (TextBox outputTbox, string outPath)
{
bool customOutDir = Config.GetInt("outFolderLoc") == 1;
outputTbox.Text = customOutDir ? Config.Get("custOutDir").Trim() : outPath;
if (customOutDir)
{
try
{
Directory.CreateDirectory(outputTbox.Text);
}
catch (Exception e)
{
Logger.Log($"Failed to create output folder: {e.Message}");
outputTbox.Text = outPath;
return false;
}
}
return true;
}
static void CheckExistingFolder (string inpath, string outpath)
{
if (Interpolate.current == null || !Interpolate.current.stepByStep) return;