diff --git a/include/ehs/system/BaseSystem.h b/include/ehs/system/BaseSystem.h index f044eb9..c3e54ab 100644 --- a/include/ehs/system/BaseSystem.h +++ b/include/ehs/system/BaseSystem.h @@ -11,5 +11,7 @@ namespace ehs static void OpenURI(const Str_8& uri); static Str_8 OpenFileDialog(const Str_8 &dir, const Str_8 &filters); + + static Str_8 GetDirDialog(const Str_8 &dir); }; } \ No newline at end of file diff --git a/include/ehs/system/System_LNX.h b/include/ehs/system/System_LNX.h index 2f8db6a..144019c 100644 --- a/include/ehs/system/System_LNX.h +++ b/include/ehs/system/System_LNX.h @@ -11,5 +11,7 @@ namespace ehs static void OpenURI(const Str_8& uri); static Str_8 OpenFileDialog(const Str_8 &dir, const Str_8 &filters); + + static Str_8 GetDirDialog(const Str_8 &dir); }; } \ No newline at end of file diff --git a/src/system/BaseSystem.cpp b/src/system/BaseSystem.cpp index 2b6a8a7..c963082 100644 --- a/src/system/BaseSystem.cpp +++ b/src/system/BaseSystem.cpp @@ -10,4 +10,9 @@ namespace ehs { return {}; } + + Str_8 BaseSystem::GetDirDialog(const Str_8 &dir) + { + return {}; + } } diff --git a/src/system/System_LNX.cpp b/src/system/System_LNX.cpp index 8ffd8b9..f837345 100644 --- a/src/system/System_LNX.cpp +++ b/src/system/System_LNX.cpp @@ -40,4 +40,22 @@ namespace ehs 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; + } }