From b3fdc9edddcd14901c5e7639fdfd331099e45e3b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 28 Feb 2021 16:45:16 +0100 Subject: [PATCH] Add ShowFileExplorer on Linux --- Source/Engine/Platform/Linux/LinuxFileSystem.cpp | 9 +++++++++ Source/Engine/Platform/Linux/LinuxFileSystem.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Source/Engine/Platform/Linux/LinuxFileSystem.cpp b/Source/Engine/Platform/Linux/LinuxFileSystem.cpp index 8fce4ea3a..78d19c556 100644 --- a/Source/Engine/Platform/Linux/LinuxFileSystem.cpp +++ b/Source/Engine/Platform/Linux/LinuxFileSystem.cpp @@ -47,6 +47,15 @@ bool LinuxFileSystem::ShowOpenFileDialog(Window* parentWindow, const StringView& return false; } +bool LinuxFileSystem::ShowFileExplorer(const StringView& path) +{ + const StringAsANSI<> pathAnsi(*path, path.Length()); + char cmd[2048]; + sprintf(cmd, "nautilus %s &", pathAnsi.Get()); + system(cmd); + return false; +} + bool LinuxFileSystem::CreateDirectory(const StringView& path) { const StringAsANSI<> pathAnsi(*path, path.Length()); diff --git a/Source/Engine/Platform/Linux/LinuxFileSystem.h b/Source/Engine/Platform/Linux/LinuxFileSystem.h index 5f74ad377..0c11f8cfd 100644 --- a/Source/Engine/Platform/Linux/LinuxFileSystem.h +++ b/Source/Engine/Platform/Linux/LinuxFileSystem.h @@ -15,6 +15,7 @@ public: // [FileSystemBase] static bool ShowOpenFileDialog(Window* parentWindow, const StringView& initialDirectory, const StringView& filter, bool multiSelect, const StringView& title, Array& filenames); + static bool ShowFileExplorer(const StringView& path); static bool CreateDirectory(const StringView& path); static bool DeleteDirectory(const String& path, bool deleteContents = true); static bool DirectoryExists(const StringView& path);