AuroraRuntime/Source/Processes/Open.Unix.cpp

37 lines
743 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
***/
#pragma once
#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: mac os is special
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));
}
}