EHS/src/system/System_LNX.cpp
Karutoh bce48fe121
All checks were successful
Build & Release / Windows-AMD64-Build (push) Successful in 6m9s
Build & Release / Linux-AMD64-Build (push) Successful in 15m26s
Build & Release / Linux-AARCH64-Build (push) Successful in 45m54s
Fixed "System::OpenURI". Added SHA256. Added URI safe Base64 methods.
2025-05-11 19:43:50 -07:00

66 lines
1.0 KiB
C++

#include "ehs/system/System_LNX.h"
#include <cstdlib>
#include <cstdio>
#include "ehs/system/Thread.h"
namespace ehs
{
UInt_32 XDG_Thread(void* args)
{
Str_8* uri = (Str_8*)args;
system("xdg-open \"" + *uri + "\"");
delete uri;
return 0;
}
void System::OpenURI(Str_8 uri)
{
Str_8 *arg = new Str_8((Str_8&&)uri);
Thread xdg;
xdg.Start(XDG_Thread, arg);
xdg.Detach();
}
Str_8 System::OpenFileDialog(const Str_8 &dir, const Str_8 &filters)
{
FILE *file = popen("kdialog --getopenfilename " + dir + " \'" + filters + "\'", "r");
Str_8 result;
char array[128];
while(fgets(array, sizeof(array), file))
result.Push(array);
pclose(file);
if (result.Size())
result.Pop();
return result;
}
Str_8 System::GetDirDialog(const Str_8 &dir)
{
FILE *file = popen("kdialog --getexistingdirectory " + dir, "r");
Str_8 result;
char array[128];
while(fgets(array, sizeof(array), file))
result.Push(array);
pclose(file);
if (result.Size())
result.Pop();
return result;
}
}