summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/cross_windows.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/cross_windows.cc b/src/lib/cross_windows.cc
index cba674fef..23a5da599 100644
--- a/src/lib/cross_windows.cc
+++ b/src/lib/cross_windows.cc
@@ -126,6 +126,9 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out)
return;
}
+ wchar_t previous_dir[512];
+ GetCurrentDirectory (sizeof(previous_dir), previous_dir);
+
wchar_t dir[512];
MultiByteToWideChar (CP_UTF8, 0, directory_containing_executable().string().c_str(), -1, dir, sizeof(dir));
SetCurrentDirectory (dir);
@@ -149,12 +152,14 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out)
ZeroMemory (&process_info, sizeof (process_info));
if (!CreateProcess (0, command, 0, 0, TRUE, CREATE_NO_WINDOW, 0, 0, &startup_info, &process_info)) {
LOG_ERROR_NC (N_("ffprobe call failed (could not CreateProcess)"));
+ SetCurrentDirectory (previous_dir);
return;
}
FILE* o = fopen_boost (out, "w");
if (!o) {
LOG_ERROR_NC (N_("ffprobe call failed (could not create output file)"));
+ SetCurrentDirectory (previous_dir);
return;
}
@@ -175,6 +180,8 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out)
CloseHandle (process_info.hProcess);
CloseHandle (process_info.hThread);
CloseHandle (child_stderr_read);
+
+ SetCurrentDirectory (previous_dir);
}
list<pair<string, string> >