From 4fd1a5edd57e9f0422c140986668d1fccba4bc82 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 19 Apr 2014 02:03:43 +0200 Subject: videotimeline: path related fixes for windows --- gtk2_ardour/add_video_dialog.cc | 4 ++++ gtk2_ardour/utils_videotl.cc | 14 +++++++------- gtk2_ardour/video_timeline.cc | 3 ++- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/add_video_dialog.cc b/gtk2_ardour/add_video_dialog.cc index 57938ac3f1..bbf2cda81d 100644 --- a/gtk2_ardour/add_video_dialog.cc +++ b/gtk2_ardour/add_video_dialog.cc @@ -313,6 +313,10 @@ AddVideoDialog::file_name (bool &local_file) CURL *curl; curl = curl_easy_init(); char *ue = curl_easy_unescape(curl, uri.c_str(), uri.length(), &plen); +#ifdef PLATFORM_WINDOWS + char *tmp; + while (tmp = strchr(ue, '/')) *tmp = '\\'; +#endif std::string path = video_get_docroot(Config) + ue; if (!::access(path.c_str(), R_OK)) { uri = path; diff --git a/gtk2_ardour/utils_videotl.cc b/gtk2_ardour/utils_videotl.cc index 2e250b2cee..3b5882905b 100644 --- a/gtk2_ardour/utils_videotl.cc +++ b/gtk2_ardour/utils_videotl.cc @@ -151,6 +151,13 @@ VideoUtils::video_map_path (std::string server_docroot, std::string filepath) { std::string rv = filepath; + /* strip docroot */ + if (server_docroot.length() > 0) { + if (rv.compare(0, server_docroot.length(), server_docroot) == 0 ) { + rv = rv.substr(server_docroot.length()); + } + } + /* replace all G_DIR_SEPARATOR with '/' */ size_t look_here = 0; size_t found_here; @@ -159,13 +166,6 @@ VideoUtils::video_map_path (std::string server_docroot, std::string filepath) look_here = found_here + 1; } - /* strip docroot */ - if (server_docroot.length() > 0) { - if (rv.compare(0, server_docroot.length(), server_docroot) == 0 ) { - rv = rv.substr(server_docroot.length()); - } - } - CURL *curl; char *ue; curl = curl_easy_init(); diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc index ca1da8d693..0a90d80978 100644 --- a/gtk2_ardour/video_timeline.cc +++ b/gtk2_ardour/video_timeline.cc @@ -452,7 +452,8 @@ VideoTimeLine::video_file_info (std::string filename, bool local) { local_file = local; - if (filename.at(0) == G_DIR_SEPARATOR || !local_file) { + if (Glib::path_is_absolute(filename) || !local_file) + { video_filename = filename; } else { video_filename = Glib::build_filename (_session->session_directory().video_path(), filename); -- cgit v1.2.3