-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLauncher.cpp
More file actions
41 lines (37 loc) · 1.1 KB
/
Launcher.cpp
File metadata and controls
41 lines (37 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <boost/algorithm/string.hpp>
#include <boost/process.hpp>
#include <boost/filesystem.hpp>
#include <boost/locale.hpp>
#include <windows.h>
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
#if _DEBUG
boost::filesystem::wifstream wstream("Debug\\Launcher.ini");
#else
boost::filesystem::wifstream wstream("Launcher.ini");
#endif
boost::locale::generator gen;
wstream.imbue(gen("UTF-8"));
std::wstring appPath;
std::wstring line;
while (std::getline(wstream, line))
{
if (boost::algorithm::find_first(line, TEXT("ApplicationPath")))
{
std::vector<std::wstring> result;
boost::split(result, line, boost::is_any_of("="));
appPath = boost::algorithm::trim_copy(result[1]);
break;
}
}
#if _DEBUG
MessageBox(NULL, appPath.c_str(), NULL, 0);
#endif
boost::process::ipstream pipe_stream;
boost::process::child process(appPath, boost::process::std_out > pipe_stream);
process.detach();
return 0;
}