AuroraRuntime/Source/Processes/Open.Unix.cpp

37 lines
743 B
C++
Raw Normal View History

2021-06-27 21:25:29 +00:00
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Open.Unix.cpp
2021-06-27 21:25:29 +00:00
Date: 2021-6-12
Author: Reece
***/
#pragma once
#include <RuntimeInternal.hpp>
#include "Processes.hpp"
#include "Open.Unix.hpp"
2021-06-27 21:25:29 +00:00
#include <unistd.h>
#include <Source/IO/FS/FS.hpp>
2021-06-27 21:25:29 +00:00
namespace Aurora::Processes
{
static void UnixOpenAsync(const AuString &open)
2021-06-27 21:25:29 +00:00
{
// TODO: mac os is special
2021-06-27 21:25:29 +00:00
if (fork() == 0)
{
setsid();
execl("xdg-open", open.c_str());
}
}
AUKN_SYM void OpenUri(const AuString &uri)
{
UnixOpenAsync(uri);
2021-06-27 21:25:29 +00:00
}
AUKN_SYM void OpenFile(const AuString &file)
{
UnixOpenAsync(IO::FS::NormalizePathRet(file));
2021-06-27 21:25:29 +00:00
}
}