Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Editor's right-click menu can open file's containing folder.
MortenMacFly:
--- Quote from: codeman on July 25, 2010, 09:07:48 pm ---MortenMacFly: were you referring to the wxExecute() command when you said it was cross-platform? We still need to use different commands for the different platforms, like I have, correct?
--- End quote ---
Partially. In the post I was referring to it shows what to use for "explorer" on the other platforms. Basically you call wxExecute with the system's default file explorer as listed in this post (of Ryan Norton):
http://forums.wxwidgets.org/viewtopic.php?p=9624#9624
codeman:
Ok shall I change my code to use wxExecute with the three different commands (explorer, xdg-open, open), and then we can put it into the codebase?
oBFusCATed:
--- Quote from: MortenMacFly on July 25, 2010, 08:19:47 pm ---I think this only applies to a web browser. What I meant was really the platform's file explorer.
--- End quote ---
No it doesn't, mime types can be used by all applications (the Enlightenment WM/shell is using them to recognize files for example).
Please make this configurable, even on windows, some people are not using the exploder, but total commander or something similar.
codeman:
Now works with all three platforms, using wxExecute.
Im pretty sure the Mac version works, but if someone would like to test it. Ive updated the patch https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=3038&group_id=5358
--- Code: ---bool EditorManager::OpenContainingFolder()
{
cbEditor* ed = GetBuiltinEditor(GetActiveEditor());
if (!ed)
return false;
const wxString& fullpath = ed->GetFilename();
wxString cmd;
#ifdef __WXMSW__
cmd = _("explorer /select,") + fullpath; //Open folder with the file selected
#else
#ifdef __WXMAC__
cmd = _("open -R ") + fullpath; //Open folder with the file selected
#else
//Cant select the file on Linux, so just extract the folder name
wxFileName::SplitPath(fullpath, &cmd, NULL, NULL);
//Use the xdg-open command
cmd = _("xdg-open ") + cmd;
#endif
#endif
wxExecute(cmd);
return true;
}
--- End code ---
Jenna:
I would prefer not to hardcode the open-commands, but making them configurable.
The configuration-defaults should be platform specific, so the user can change the default command to his/her needs.
It would be a little bit like "Terminal to launch console apps", but for all platforms and not only for non-windows platforms.
Should not be too hard to implement.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version