more path-building fixes from colinf

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3388 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-05-22 16:38:36 +00:00
parent 93664a2ada
commit eb8fa216c2
6 changed files with 13 additions and 31 deletions

View 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);

View 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

View 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());

View 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

View 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());

View 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