Added System::GetDirDialog.

This commit is contained in:
Arron David Nelson 2024-08-04 02:09:10 -07:00
parent 8d4420528a
commit 86a35fd668
4 changed files with 27 additions and 0 deletions

View File

@ -11,5 +11,7 @@ namespace ehs
static void OpenURI(const Str_8& uri); static void OpenURI(const Str_8& uri);
static Str_8 OpenFileDialog(const Str_8 &dir, const Str_8 &filters); static Str_8 OpenFileDialog(const Str_8 &dir, const Str_8 &filters);
static Str_8 GetDirDialog(const Str_8 &dir);
}; };
} }

View File

@ -11,5 +11,7 @@ namespace ehs
static void OpenURI(const Str_8& uri); static void OpenURI(const Str_8& uri);
static Str_8 OpenFileDialog(const Str_8 &dir, const Str_8 &filters); static Str_8 OpenFileDialog(const Str_8 &dir, const Str_8 &filters);
static Str_8 GetDirDialog(const Str_8 &dir);
}; };
} }

View File

@ -10,4 +10,9 @@ namespace ehs
{ {
return {}; return {};
} }
Str_8 BaseSystem::GetDirDialog(const Str_8 &dir)
{
return {};
}
} }

View File

@ -40,4 +40,22 @@ namespace ehs
return result; 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;
}
} }