Page 1 of 1
Open Containing File Folder
Posted: Wed Oct 15, 2025 8:32 pm
by marcoagpinto
Heya,
I want to right-click on a tab and select to open the folder with the file associated to the tab (open folder with the file selected, or just open the file folder, whatever it is possible).
How do I make it cross-platform?
Thanks!
Re: Open Containing File Folder
Posted: Wed Oct 15, 2025 9:26 pm
by spikey
On Windows:
Code: Select all
RunProgram("explorer.exe", "/SELECT," + #DQUOTE$ + File$ + #DQUOTE$, "")
and Mac:
Code: Select all
RunProgram("open", "-R " + #DQUOTE$ + File$ + #DQUOTE$, "")
Linux is more complicated because first you've got to work out which File manager is in use. Have a look at the procedure 'DetectFileManager()' in the file LinuxExtensions.pb in the IDE's repo, see
https://github.com/fantaisie-software/p ... ensions.pb.
Re: Open Containing File Folder
Posted: Wed Oct 15, 2025 9:42 pm
by marcoagpinto
spikey wrote: Wed Oct 15, 2025 9:26 pm
On Windows:
Code: Select all
RunProgram("explorer.exe", "/SELECT," + #DQUOTE$ + File$ + #DQUOTE$, "")
and Mac:
Code: Select all
RunProgram("open", "-R " + #DQUOTE$ + File$ + #DQUOTE$, "")
Linux is more complicated because first you've got to work out which File manager is in use. Have a look at the procedure 'DetectFileManager()' in the file LinuxExtensions.pb in the IDE's repo, see
https://github.com/fantaisie-software/p ... ensions.pb.
Heya,
Thank you.
The Linux will take a lot of effort, I believe.

Re: Open Containing File Folder
Posted: Thu Oct 16, 2025 12:01 am
by moulder61
@marcoagpinto
I just tried this in Linux and it opens my default file manager. I have no idea how you incorporate that into a program to do what you want though?
RunProgram("exo-open", "--launch FileManager", "")
Moulder.
Re: Open Containing File Folder
Posted: Thu Oct 16, 2025 2:55 am
by marcoagpinto
moulder61 wrote: Thu Oct 16, 2025 12:01 am
@marcoagpinto
I just tried this in Linux and it opens my default file manager. I have no idea how you incorporate that into a program to do what you want though?
RunProgram("exo-open", "--launch FileManager", "")
Moulder.
Heya,
And the path is in the last
?
Thanks!
Re: Open Containing File Folder
Posted: Thu Oct 16, 2025 9:04 am
by moulder61
@marcoagpinto
Maybe? I was just trying to work out how to get the default file manager to open in Linux. That code worked for me.
What the rest of your code needs to be, I have no idea? You have to work that bit out yourself.
I only ran that one line I suggested on it's own. I was just trying to point you in the right direction, hopefully
Looking at spikey's examples, maybe add + #DQUOTE$ + File$ + #DQUOTE$ to the second parameter. I'm just guessing at the moment.
The help file says that the last parameter is the working directory. It's optional, but if you use the second parameter you also have to use the third, even if it's empty, else the RunProgram() command doesn't work, in my experience.
Moulder.
Re: Open Containing File Folder
Posted: Thu Oct 16, 2025 12:29 pm
by AZJIO
Linux
Code: Select all
RunProgram("xdg-open", Path$, "")
; RunProgram("xdg-open", FilePath$, GetPathPart(FilePath$))
I
suggested adding this to the help.
Re: Open Containing File Folder
Posted: Thu Oct 16, 2025 9:09 pm
by marcoagpinto
Thank you all!
Re: Open Containing File Folder
Posted: Fri Oct 17, 2025 1:32 pm
by Piero
spikey wrote: Wed Oct 15, 2025 9:26 pmMac:
Code: Select all
RunProgram("open", "-R " + #DQUOTE$ + File$ + #DQUOTE$, "")
Linux is more complicated


… """#DQUOTE$""" is NOT
foolproof for Mac/Linux…