diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-01-17 09:24:18 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-01-17 09:24:32 -0500 |
commit | 17309c41c3afde42af9cb5c11031bbfd1409cf89 (patch) | |
tree | 164e543c2ab974e4bc32f030ea81d5232bd0bbaa /gtk2_ardour/editor.cc | |
parent | 0479405e2f0cd44b75ba789cd620cb43bb9f9ffb (diff) |
use Glib URI utility function to generate a local filename from a URI, rather than hand-crafted code
Diffstat (limited to 'gtk2_ardour/editor.cc')
-rw-r--r-- | gtk2_ardour/editor.cc | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index faa2a0cf56..f14180d8a7 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -47,6 +47,7 @@ #include "pbd/stacktrace.h" #include <glibmm/miscutils.h> +#include <glibmm/uriutils.h> #include <gtkmm/image.h> #include <gdkmm/color.h> #include <gdkmm/bitmap.h> @@ -3173,33 +3174,8 @@ Editor::convert_drop_to_paths ( } for (vector<string>::iterator i = uris.begin(); i != uris.end(); ++i) { - if ((*i).substr (0,7) == "file://") { - - string const p = PBD::url_decode (*i); - - // scan forward past three slashes - - string::size_type slashcnt = 0; - string::size_type n = 0; - string::const_iterator x = p.begin(); - - while (slashcnt < 3 && x != p.end()) { - if ((*x) == '/') { - slashcnt++; - } else if (slashcnt == 3) { - break; - } - ++n; - ++x; - } - - if (slashcnt != 3 || x == p.end()) { - error << _("malformed URL passed to drag-n-drop code") << endmsg; - continue; - } - - paths.push_back (p.substr (n - 1)); + paths.push_back (Glib::filename_from_uri (*i)); } } @@ -3208,7 +3184,6 @@ Editor::convert_drop_to_paths ( void Editor::new_tempo_section () - { } |