@@ -36,7 +36,12 @@ Shell injection is possible, so make sure the URL is trusted or hard coded. | |||||
May block, so open in a new thread. | May block, so open in a new thread. | ||||
*/ | */ | ||||
void openBrowser(const std::string &url); | void openBrowser(const std::string &url); | ||||
/** Opens Explorer, Finder, etc at the folder location. */ | |||||
void openFolder(const std::string &path); | void openFolder(const std::string &path); | ||||
/** Runs an executable without blocking. | |||||
The launched process will continue running if the current process is closed. | |||||
*/ | |||||
void runProcessAsync(const std::string &path); | |||||
} // namespace system | } // namespace system | ||||
@@ -174,6 +174,21 @@ void openFolder(const std::string &path) { | |||||
} | } | ||||
void runProcessAsync(const std::string &path) { | |||||
#if defined ARCH_WIN | |||||
STARTUPINFO startupInfo; | |||||
PROCESS_INFORMATION processInfo; | |||||
std::memset(&startupInfo, 0, sizeof(startupInfo)); | |||||
startupInfo.cb = sizeof(startupInfo); | |||||
std::memset(&processInfo, 0, sizeof(processInfo)); | |||||
CreateProcessA(path.c_str(), NULL, | |||||
NULL, NULL, false, 0, NULL, NULL, | |||||
&startupInfo, &processInfo); | |||||
#endif | |||||
} | |||||
} // namespace system | } // namespace system | ||||
} // namespace rack | } // namespace rack |