32{
33
34
35
36#ifdef _WIN32
37 const wxString widepath =
from_u8(path);
38 const wchar_t* argv[] = {
L"explorer", widepath.GetData(),
nullptr };
39 ::wxExecute(argv, wxEXEC_ASYNC, nullptr);
40#elif __APPLE__
41 const char* argv[] = { "open", path.data(), nullptr };
42 ::wxExecute(argv, wxEXEC_ASYNC, nullptr);
43#else
44 const char* argv[] = { "xdg-open", path.data(), nullptr };
45
46
47
48
49 if (wxGetEnv("APPIMAGE", nullptr)) {
50
51 wxEnvVariableHashMap env_vars;
52 wxGetEnvMap(&env_vars);
53
54 env_vars.erase("APPIMAGE");
55 env_vars.erase("APPDIR");
56 env_vars.erase("LD_LIBRARY_PATH");
57 env_vars.erase("LD_PRELOAD");
58 env_vars.erase("UNION_PRELOAD");
59
60 wxExecuteEnv exec_env;
61 exec_env.env = std::move(env_vars);
62
63 wxString owd;
64 if (wxGetEnv("OWD", &owd)) {
65
66
67 exec_env.cwd = std::move(owd);
68 }
69
70 ::wxExecute(argv, wxEXEC_ASYNC, nullptr, &exec_env);
71 }
72 else {
73
74 ::wxExecute(argv, wxEXEC_ASYNC, nullptr, nullptr);
75 }
76#endif
77}
#define L(s)
Definition ExtrusionEntity.cpp:25
wxString from_u8(const std::string &str)
Definition GUI.cpp:544