Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

mimehandling plugin tweaks

(1/2) > >>

dmoore:
"Use Associated App" currently fails for paths with spaces:


--- Code: ---Index: src/plugins/defaultmimehandler/defaultmimehandler.cpp
===================================================================
--- src/plugins/defaultmimehandler/defaultmimehandler.cpp (revision 5719)
+++ src/plugins/defaultmimehandler/defaultmimehandler.cpp (working copy)
@@ -301,10 +301,10 @@
         ShellExecute(0, wxString(_T("open")).c_str(), filename.c_str(), 0, 0, SW_SHOW);
         #endif
         #ifdef __WXGTK__
-        wxExecute(wxString::Format(_T("xdg-open %s"), filename.c_str()));
+        wxExecute(wxString::Format(_T("xdg-open \"%s\""), filename.c_str()));
         #endif
         #ifdef __WXMAC__
-        wxExecute(wxString::Format(_T("open %s"), filename.c_str()));
+        wxExecute(wxString::Format(_T("open \"%s\""), filename.c_str()));
         #endif
         return 0;
     }

--- End code ---

ok?

MortenMacFly:

--- Quote from: dmoore on July 30, 2009, 03:45:22 am ---ok?

--- End quote ---
If that is working like that on the MAC and GTK - sure, go ahead.

oBFusCATed:
And what about escaping the double quotes in the filename?

dmoore:

--- Quote from: oBFusCATed on July 30, 2009, 10:04:36 am ---And what about escaping the double quotes in the filename?

--- End quote ---

what do we currently use to escape filenames? alternatively, i'll just call the wxExecute variant that takes the argv array directly, which should handle the paths without escaping them.

oBFusCATed:
I'm not 100% sure, but replacing " with \" in the filename would do the trick, because that is the purpose of the quotes around the file name.

Navigation

[0] Message Index

[#] Next page

Go to full version