Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Commit 66072d0

Browse files
Merge pull request #650 from sobisht/FileExistCheckLinux
Linux: Add a check for file exist when "Show in OS" is clicked
2 parents 99fae15 + eb4b112 commit 66072d0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

appshell/appshell_extensions_gtk.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,12 @@ int ShowFolderInOSWindow(ExtensionString pathname)
723723
GError *gerror = NULL;
724724
gchar *uri = NULL, *parentdir = NULL;
725725

726+
// Check if file exist in OS
727+
struct stat fileStat;
728+
if (stat(pathname.c_str(), &fileStat) != 0) {
729+
return ERR_NOT_FOUND;
730+
}
731+
726732
if (g_file_test(pathname.c_str(), G_FILE_TEST_IS_DIR)) {
727733
uri = g_filename_to_uri(pathname.c_str(), NULL, NULL);
728734
if (!gtk_show_uri(NULL, uri, GDK_CURRENT_TIME, &gerror)) {

0 commit comments

Comments
 (0)