diff options
author | pommicket <pommicket@gmail.com> | 2023-08-04 21:39:13 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-04 21:42:53 -0400 |
commit | 49ab483be3e7af88a3932a43f222aa42cacd3515 (patch) | |
tree | 9ad0157a22ed6cd9c54458b6c75ffa7eaa2253e7 /os-posix.c | |
parent | ce199f9384f9f9376417110574a07cfd731e3a79 (diff) |
document links seem to be working
Diffstat (limited to 'os-posix.c')
-rw-r--r-- | os-posix.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -388,3 +388,23 @@ int process_check_status(Process **pproc, ProcessExitInfo *info) { return -1; } } + +bool open_with_default_application(const char *path) { + const char *cmd = NULL; +#if __linux__ + cmd = "xdg-open"; +#elif __APPLE__ + cmd = "open"; +#endif + if (!cmd) + return false; + switch (fork()) { + case 0: + execlp(cmd, cmd, path, NULL); + abort(); + case -1: + return false; + default: + return true; + } +} |