66 lines
1.0 KiB
C++
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;
|
|
}
|
|
}
|