@@ -1180,8 +1180,18 @@ class FileUtil
11801180 // thats why the above comment is there!
11811181 Sys .command (' open' , [pathFolder ]);
11821182 #elseif linux
1183- // TODO: implement linux
1184- // some shit with xdg-open :thinking: emoji...
1183+ var exitCode = Sys .command (" xdg-open" , [pathFolder ]);
1184+ if (exitCode == 0 ) return ;
1185+ var fileManagers : Array <String > = [" dolphin" , " nautilus" , " nemo" , " thunar" , " caja" , " konqueror" , " spacefm" , " pcmanfm" ];
1186+
1187+ for (fm in fileManagers ) {
1188+ if (Sys .command (" which" , [fm ]) == 0 ) {
1189+ exitCode = Sys .command (fm , [pathFolder ]);
1190+ if (exitCode == 0 ) return ;
1191+ }
1192+ }
1193+
1194+ trace (' No compatible file manager found for Linux.' );
11851195 #end
11861196 #else
11871197 throw ' External folder open is not supported on this platform.' ;
@@ -1207,8 +1217,9 @@ class FileUtil
12071217 #elseif mac
12081218 Sys .command (' open' , [' -R' , path ]);
12091219 #elseif linux
1210- // TODO: unsure of the linux equivalent to opening a folder and then "selecting" a file.
1211- Sys .command (' open' , [path ]);
1220+ trace (' File selection not reliably supported on Linux, opening parent folder instead.' );
1221+ path = Path .directory (path );
1222+ openFolder (path );
12121223 #end
12131224 #else
12141225 throw ' External file selection is not supported on this platform.' ;
0 commit comments