mk-soft's Linux solution only works with file manager Nautilus. But many Linux distributions utilize other file managers, so mk-soft's solution doesn't work on my Linux Mint 19.3 with Cinnamon where the default file manager is Nemo. I therefore try to find out the name of the default file manager. Unfortunately my method is not fool proof but it should work with more distributions and file managers than mk-soft's approach.
Code: Select all
FileToShow$ = ProgramFilename()
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
RunProgram("explorer.exe", "/select," + #DQUOTE$ + FileToShow$ + #DQUOTE$, "")
CompilerElseIf #PB_Compiler_OS = #PB_OS_MacOS
RunProgram("open", "-R " + #DQUOTE$ + FileToShow$ + #DQUOTE$, "")
CompilerElseIf #PB_Compiler_OS = #PB_OS_Linux
ProgramID = RunProgram("xdg-mime", "query default inode/directory", "",
#PB_Program_Open | #PB_Program_Read)
If ProgramID = 0
MessageRequester("Error",
"Search for default file manager failed!")
Else
FileManager$ = ReadProgramString(ProgramID)
CloseProgram(ProgramID)
RunProgram("gtk-launch", FileManager$ + " " + FileToShow$, "")
EndIf
CompilerEndIf