AuroraRuntime/Source/Processes/Open.Unix.cpp

36 lines
783 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Open.Unix.cpp
Date: 2021-6-12
Author: Reece
***/
#include <RuntimeInternal.hpp>
#include "Processes.hpp"
#include "Open.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));
}
}