more path-building fixes from colinf
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 22 May 2008 16:38:36 +0000 (16:38 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 22 May 2008 16:38:36 +0000 (16:38 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3388 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/export_dialog.cc
libs/ardour/audiofilesource.cc
libs/ardour/io.cc
libs/ardour/panner.cc
libs/ardour/redirect.cc
libs/ardour/session.cc

index 5fe5a56205cb783415bf50911c23909e55e515d1..e186f3712e2ba032fa7ee3ba32409d8f1d581066 100644 (file)
@@ -1019,12 +1019,12 @@ ExportDialog::start_export ()
                string dir = session->export_dir();
                string::size_type last_slash;
                
-               if ((last_slash = dir.find_last_of ('/')) != string::npos && last_slash != 0) {
+               if ((last_slash = dir.find_last_of (G_DIR_SEPARATOR_S)) != string::npos && last_slash != 0) {
                        dir = dir.substr (0, last_slash+1);
                }
 
                if (!wants_dir()) {
-                       dir = dir + "export.wav";
+                       dir = dir + "export.wav"; // Glib::build_filename() ?
                }
                
                file_entry.set_text (dir);
index ba900267406e3e4a5ff1c9d00808a9dd8f722d3d..919e9587fe10ad34f791de2bdf4242bf118e08c8 100644 (file)
@@ -222,13 +222,7 @@ AudioFileSource::find_broken_peakfile (ustring peak_path, ustring audio_path)
 ustring
 AudioFileSource::broken_peak_path (ustring audio_path)
 {
-       ustring res;
-
-       res = _session.peak_dir ();
-       res += PBD::basename_nosuffix (audio_path);
-       res += ".peak";
-
-       return res;
+       return Glib::build_filename(_session.peak_dir (), PBD::basename_nosuffix (audio_path) + ".peak");
 }
 
 ustring
index 10b1e423288e59a9d4b2dfaaf01f6f64369b7f51..ac5381b5910e97a51e035f1355176b84474d07e4 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <sigc++/bind.h>
 
+#include <glibmm.h>
 #include <glibmm/thread.h>
 
 #include <pbd/xml++.h>
@@ -1669,16 +1670,12 @@ IO::load_automation (string path)
        float version;
        LocaleGuard lg (X_("POSIX"));
 
-       fullpath = _session.automation_dir();
-       fullpath += path;
+       fullpath = Glib::build_filename(_session.automation_dir(), path);
 
        in.open (fullpath.c_str());
 
        if (!in) {
-               fullpath = _session.automation_dir();
-               fullpath += _session.snap_name();
-               fullpath += '-';
-               fullpath += path;
+               fullpath = Glib::build_filename(_session.automation_dir(), _session.snap_name() + '-' + path);
 
                in.open (fullpath.c_str());
 
index eb9547edffa87d965c568c3170eff7cb89f82470..db802b0921fce4a79645db313ec6fb4ae47712a1 100644 (file)
@@ -1155,8 +1155,7 @@ Panner::set_state (const XMLNode& node)
 
                /* automation path is relative */
                
-               automation_path = _session.automation_dir();
-               automation_path += prop->value ();
+               automation_path = Glib::build_filename(_session.automation_dir(), prop->value ());
        } 
 
        return 0;
@@ -1324,11 +1323,8 @@ Panner::set_position (float xpos, float ypos, float zpos, StreamPanner& orig)
 void
 Panner::set_name (string str)
 {
-       automation_path = _session.automation_dir();
-       automation_path += _session.snap_name();
-       automation_path += "-pan-";
-       automation_path += legalize_for_path (str);
-       automation_path += ".automation";
+       automation_path = Glib::build_filename(_session.automation_dir(), 
+               _session.snap_name() + "-pan-" + legalize_for_path (str) + ".automation");
 }
 
 int
index b1e631015fc3fcedacb01d287ec69349bf21c4aa..afb166b8cbc1a79d664810458cfcc0286ad399fd 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <sigc++/bind.h>
 
+#include <glibmm.h>
+
 #include <pbd/xml++.h>
 #include <pbd/enumwriter.h>
 
@@ -342,8 +344,7 @@ Redirect::load_automation (string path)
        if (path[0] == '/') { // legacy
                fullpath = path;
        } else {
-               fullpath = _session.automation_dir();
-               fullpath += path;
+               fullpath = Glib::build_filename(_session.automation_dir(), path);
        }
        ifstream in (fullpath.c_str());
 
index b11ed56a6ecc6018bbb5508eb799aec608d84590..2a10773d0955f5d861445d99f8638f32d63cf51b 100644 (file)
@@ -2970,13 +2970,7 @@ Session::source_by_path_and_channel (const Glib::ustring& path, uint16_t chn)
 Glib::ustring
 Session::peak_path (Glib::ustring base) const
 {
-       Glib::ustring res;
-       
-       res = peak_dir ();
-       res += base;
-       res += ".peak";
-
-       return res;
+       return Glib::build_filename(peak_dir (), base + ".peak");
 }
 
 string