Open a file from inside wxApp in system file manager. Topic is solved
Open a file from inside wxApp in system file manager.
Is there some way to open a file in system file manager from inside the wxApp provided the absolute path for file?
Re: Open a file from inside wxApp in system file manager.
There is wxLaunchDefaultApplication():
https://docs.wxwidgets.org/trunk/group_ ... f82b2d66c3
But that does what its description does. I am no sure it is what you want, i.e., "open a file in system file manager". That looks like a Linux-specific thing, there is no such thing in MS Windows (aside from launching File Explorer in a specified folder).
https://docs.wxwidgets.org/trunk/group_ ... f82b2d66c3
But that does what its description does. I am no sure it is what you want, i.e., "open a file in system file manager". That looks like a Linux-specific thing, there is no such thing in MS Windows (aside from launching File Explorer in a specified folder).
Re: Open a file from inside wxApp in system file manager.
wxLaunchDefaultApplication() is, if I understand correctly, it will open the default application for type of file it is, say user clicks on a video file, and the default video player for the system is set to VLC then it will open VLC, then it is not what I want.PB wrote: ↑Thu Mar 18, 2021 6:18 am There is wxLaunchDefaultApplication():
https://docs.wxwidgets.org/trunk/group_ ... f82b2d66c3
But that does what its description does. I am no sure it is what you want, i.e., "open a file in system file manager". That looks like a Linux-specific thing, there is no such thing in MS Windows (aside from launching File Explorer in a specified folder).
I want that if a user right clicks on a file that is inserted into say a wxDVLC and choose something like open/show file in explorer, it just opens the file explorer with the path to where the selected file is located.
Re: Open a file from inside wxApp in system file manager.
I see. I am not aware of any such portable function in wxWidgets. That is what FireFox in Download Manager on Window when right-clicking on a file calls "Open Containing Folder".
AFAIK, for example MS Windows does not have a concept of "default file manager". You can set default application for example for Web Browser or Media Player but not for Shell Manager, so I cannot set Total Commander I am using as my file manager, Microsoft's File Explorer is always the one and one would have to do something like this.
I suppose this may be different on Linux, where one can select a file manager as the default, e.g. Double Commander instead of whatever the distribution offers as its default?
But perhaps it could be possible to implement portable wxBrowseToFile() function...
AFAIK, for example MS Windows does not have a concept of "default file manager". You can set default application for example for Web Browser or Media Player but not for Shell Manager, so I cannot set Total Commander I am using as my file manager, Microsoft's File Explorer is always the one and one would have to do something like this.
I suppose this may be different on Linux, where one can select a file manager as the default, e.g. Double Commander instead of whatever the distribution offers as its default?
But perhaps it could be possible to implement portable wxBrowseToFile() function...
Re: Open a file from inside wxApp in system file manager.
There is a command in Linux xdg-open, which opens the default application for the file type, passed as the second argument. The system's default file manager in my case, as I only pass the path to a folder. I am handling this problem with,PB wrote: ↑Thu Mar 18, 2021 8:05 am I see. I am not aware of any such portable function in wxWidgets. That is what FireFox in Download Manager on Window when right-clicking on a file calls "Open Containing Folder".
AFAIK, for example MS Windows does not have a concept of "default file manager". You can set default application for example for Web Browser or Media Player but not for Shell Manager, so I cannot set Total Commander I am using as my file manager, Microsoft's File Explorer is always the one and one would have to do something like this.
I suppose this may be different on Linux, where one can select a file manager as the default, e.g. Double Commander instead of whatever the distribution offers as its default?
But perhaps it could be possible to implement portable wxBrowseToFile() function...
Code: Select all
wxExecute(wxString::Format("xdg-open '%s'", sample_path.BeforeLast('/')));
https://unix.stackexchange.com/question ... pen-a-file
https://linux.die.net/man/1/xdg-open