Skip to content

Commit

Permalink
Fix _mask load when filename (not full path) provided as cmd-line arg
Browse files Browse the repository at this point in the history
  • Loading branch information
gregruthenbeck committed Jan 27, 2021
1 parent 99cf4ea commit 9e252c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,12 @@ private void Form1_Load(object sender, EventArgs e)
return;
string ext = Path.GetExtension(arg).ToLower();
if (ext == ".txt" || ext == ".cfg") {
if (!File.Exists(arg)) // if not found, prepend the default folder
arg = Path.GetDirectoryName(_videoFilepath) + "\\" + arg;
LoadSettings(arg);
} else if (ext == ".png" && Path.GetFileNameWithoutExtension(arg).Contains("mask")) {
if (!File.Exists(arg)) // if not found, prepend the default folder
arg = Path.GetDirectoryName(_videoFilepath) + "\\" + arg;
_mask = new Image<Gray, byte>(arg);
} else if (ext == ".avi" || ext == ".mkv" || ext == ".mp4" || ext == ".mpeg" || ext == ".mov" || ext == ".mts" || ext == ".wmv") {
OpenVideo(arg);
Expand Down Expand Up @@ -871,8 +875,6 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
private void LoadSettings(string filepath) {
try {
_processingSleep = true;
if (!File.Exists(filepath)) // if not found, prepend the default folder
filepath = Path.GetDirectoryName(_videoFilepath) + "\\" + filepath;
_settingsControl.LoadSettings(filepath);
} catch {
} finally {
Expand Down

0 comments on commit 9e252c8

Please sign in to comment.