36 lines
789 B
C++
36 lines
789 B
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AuOpen.Unix.cpp
|
|
Date: 2021-6-12
|
|
Author: Reece
|
|
***/
|
|
#include <RuntimeInternal.hpp>
|
|
#include "AuProcesses.hpp"
|
|
#include "AuOpen.Unix.hpp"
|
|
|
|
#include <unistd.h>
|
|
#include <Source/IO/FS/FS.hpp>
|
|
|
|
namespace Aurora::Processes
|
|
{
|
|
static void UnixOpenAsync(const AuString &open)
|
|
{
|
|
// TODO: MacOS is special. This will break IPC and the process binary is 'open'
|
|
if (fork() == 0)
|
|
{
|
|
setsid();
|
|
execl("xdg-open", open.c_str());
|
|
}
|
|
}
|
|
|
|
AUKN_SYM void OpenUri(const AuString &uri)
|
|
{
|
|
UnixOpenAsync(uri);
|
|
}
|
|
|
|
AUKN_SYM void OpenFile(const AuString &file)
|
|
{
|
|
UnixOpenAsync(IO::FS::NormalizePathRet(file));
|
|
}
|
|
} |