2024-10-21 04:36:08 +02:00
|
|
|
function shellOpenExplorer(path) {
|
2023-12-13 11:09:06 +01:00
|
|
|
if(OS == os_windows) {
|
|
|
|
var _windir = environment_get_variable("WINDIR") + "/explorer.exe";
|
|
|
|
path = string_replace_all(path, "/", "\\");
|
|
|
|
shell_execute_async(_windir, path);
|
2024-10-21 04:36:08 +02:00
|
|
|
|
2023-12-13 11:09:06 +01:00
|
|
|
} else if(OS == os_macosx) {
|
|
|
|
path = string_replace_all(path, "\\", "/");
|
|
|
|
var res = shell_execute_async("open", path);
|
|
|
|
}
|
2024-05-03 09:02:18 +02:00
|
|
|
|
|
|
|
return 0;
|
2024-10-21 04:36:08 +02:00
|
|
|
}
|
2023-09-28 13:15:29 +02:00
|
|
|
|
2024-12-19 04:31:55 +01:00
|
|
|
function shell_execute_output(path, command, ref = noone, _log = true) { return ExecutedProcessReadFromStandardOutput(shell_execute(path, command)); }
|
|
|
|
|
2024-10-21 04:36:08 +02:00
|
|
|
function shell_execute(path, command, ref = noone, _log = true) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-09-28 13:15:29 +02:00
|
|
|
|
2024-12-17 04:24:48 +01:00
|
|
|
// if(OS == os_macosx) {
|
2024-12-19 04:31:55 +01:00
|
|
|
path = string_replace_all(path, "\\", "/");
|
|
|
|
command = string_replace_all(command, "\\", "/");
|
2024-12-17 04:24:48 +01:00
|
|
|
// }
|
2023-12-15 12:56:36 +01:00
|
|
|
|
2024-12-17 04:24:48 +01:00
|
|
|
var cmd = $"{path} {command}";
|
|
|
|
var res = ProcessExecute(cmd);
|
2024-10-21 04:36:08 +02:00
|
|
|
if(_log) print($"Execute {path} {command} | {res}");
|
2023-11-03 14:43:28 +01:00
|
|
|
|
|
|
|
return res;
|
2024-10-21 04:36:08 +02:00
|
|
|
}
|
2023-11-01 08:10:25 +01:00
|
|
|
|
2024-10-21 04:36:08 +02:00
|
|
|
function shell_execute_async(path, command, ref = noone, _log = true) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-11-01 08:10:25 +01:00
|
|
|
|
2024-02-12 13:59:43 +01:00
|
|
|
if(IS_CMD) return shell_execute(path, command, ref);
|
|
|
|
|
2023-12-15 12:56:36 +01:00
|
|
|
if(OS == os_macosx) {
|
|
|
|
path = string_replace_all(path, "\\", "/");
|
|
|
|
command = string_replace_all(command, "\\", "/");
|
|
|
|
}
|
|
|
|
|
2024-12-17 04:24:48 +01:00
|
|
|
var cmd = $"{path} {command}";
|
|
|
|
var res = ProcessExecuteAsync(cmd);
|
2024-05-01 14:28:15 +02:00
|
|
|
if(_log) print($"Execute async {path} {command} | {res}");
|
2023-11-03 14:43:28 +01:00
|
|
|
|
|
|
|
return res;
|
2024-10-21 04:36:08 +02:00
|
|
|
}
|
2023-12-13 11:09:06 +01:00
|
|
|
|
2024-10-21 04:36:08 +02:00
|
|
|
function env_user() {
|
2023-12-13 11:09:06 +01:00
|
|
|
INLINE
|
|
|
|
|
2024-09-10 04:16:50 +02:00
|
|
|
if(OS == os_windows) return string(environment_get_variable("userprofile")) + "/AppData/Local/PixelComposer/";
|
2023-12-13 11:09:06 +01:00
|
|
|
if(OS == os_macosx) return string(environment_get_variable("HOME")) + "/PixelComposer/";
|
|
|
|
return "";
|
2024-10-21 04:36:08 +02:00
|
|
|
}
|