Open Containing File Folder
- marcoagpinto
- Addict

- Posts: 1076
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Open Containing File Folder
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!
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
On Windows:
and Mac:
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.
Code: Select all
RunProgram("explorer.exe", "/SELECT," + #DQUOTE$ + File$ + #DQUOTE$, "")Code: Select all
RunProgram("open", "-R " + #DQUOTE$ + File$ + #DQUOTE$, "")- marcoagpinto
- Addict

- Posts: 1076
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Open Containing File Folder
Heya,spikey wrote: Wed Oct 15, 2025 9:26 pm On Windows:and Mac:Code: Select all
RunProgram("explorer.exe", "/SELECT," + #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.Code: Select all
RunProgram("open", "-R " + #DQUOTE$ + File$ + #DQUOTE$, "")
Thank you.
The Linux will take a lot of effort, I believe.
Re: Open Containing File Folder
@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.
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.
"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
- marcoagpinto
- Addict

- Posts: 1076
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Open Containing File Folder
Heya,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.
And the path is in the last
Code: Select all
""Thanks!
Re: Open Containing File Folder
@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.
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.
"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Re: Open Containing File Folder
Linux
I suggested adding this to the help.
Code: Select all
RunProgram("xdg-open", Path$, "")
; RunProgram("xdg-open", FilePath$, GetPathPart(FilePath$))- marcoagpinto
- Addict

- Posts: 1076
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Open Containing File Folder
Thank you all!
Re: Open Containing File Folder
spikey wrote: Wed Oct 15, 2025 9:26 pmMac:Linux is more complicatedCode: Select all
RunProgram("open", "-R " + #DQUOTE$ + File$ + #DQUOTE$, "")
