summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-04-15 14:41:38 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-04-15 14:41:38 +0000
commit5565078136e72c6c098fc4b4b688f6c1af58d069 (patch)
treedb7aa276be3e7b08480eda6bc1e1e5aee40c8af4 /gtk2_ardour
parent1d1de9b669a141954a252a1d0173ddc6348cba9c (diff)
remove a bunch of explicit uses of '/' as a directory separator; use Glib::build_filename() to construct more paths rather than doing it "by hand"; fixup small logic mistake (which had no actual consequences) in export track marker dialog
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6909 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour_ui.cc15
-rw-r--r--gtk2_ardour/editor_audio_import.cc5
-rw-r--r--gtk2_ardour/editor_region_list.cc2
-rw-r--r--gtk2_ardour/export_range_markers_dialog.cc12
-rw-r--r--gtk2_ardour/imageframe_socket_handler.cc7
-rw-r--r--gtk2_ardour/new_session_dialog.cc8
-rw-r--r--gtk2_ardour/opts.cc2
7 files changed, 17 insertions, 34 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index a12783ac94..979dc1237c 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -1039,7 +1039,7 @@ ARDOUR_UI::redisplay_recent_sessions ()
/* remove any trailing / */
- if (fullpath[fullpath.length()-1] == '/') {
+ if (fullpath[fullpath.length()-1] == G_DIR_SEPARATOR) {
fullpath = fullpath.substr (0, fullpath.length()-1);
}
@@ -2204,11 +2204,8 @@ ARDOUR_UI::load_cmdline_session (const Glib::ustring& session_name, const Glib::
if (Glib::file_test (session_path, Glib::FILE_TEST_IS_DIR)) {
Glib::ustring predicted_session_file;
-
- predicted_session_file = session_path;
- predicted_session_file += '/';
- predicted_session_file += session_name;
- predicted_session_file += Session::statefile_suffix();
+
+ predicted_session_file = Glib::build_filename (session_path, session_name + Session::statefile_suffix());
if (Glib::file_test (predicted_session_file, Glib::FILE_TEST_EXISTS)) {
existing_session = true;
@@ -2497,9 +2494,9 @@ ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be
convert what they typed into a path & a name
*/
- if (session_name[0] == '/' ||
- (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
- (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) {
+ if (Glib::path_is_absolute (session_name) ||
+ (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == G_DIR_SEPARATOR) ||
+ (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == G_DIR_SEPARATOR)) {
session_path = Glib::path_get_dirname (session_name);
session_name = Glib::path_get_basename (session_name);
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index 3f9192828e..4f1a63b42e 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -534,10 +534,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
/* lets see if we can link it into the session */
- linked_path = session->sound_dir();
- linked_path += '/';
- linked_path += Glib::path_get_basename (path);
-
+ linked_path = Glib::build_filename (session->sound_dir(), Glib::path_get_basename (path));
path_to_use = path;
if (link (path.c_str(), linked_path.c_str()) == 0) {
diff --git a/gtk2_ardour/editor_region_list.cc b/gtk2_ardour/editor_region_list.cc
index 0e14391895..d56bf4844e 100644
--- a/gtk2_ardour/editor_region_list.cc
+++ b/gtk2_ardour/editor_region_list.cc
@@ -149,7 +149,7 @@ Editor::add_audio_region_to_region_display (boost::shared_ptr<AudioRegion> regio
}
row[region_list_columns.color_] = c;
- if (region->source()->name()[0] == '/') { // external file
+ if (Glib::path_is_absolute (region->source()->name())) { // external file
/* XXX there was old code here to try to show an abbreviated version
of the path name for whole file regions.
diff --git a/gtk2_ardour/export_range_markers_dialog.cc b/gtk2_ardour/export_range_markers_dialog.cc
index 50b8098d60..5a04b25f86 100644
--- a/gtk2_ardour/export_range_markers_dialog.cc
+++ b/gtk2_ardour/export_range_markers_dialog.cc
@@ -110,22 +110,16 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList&
string
ExportRangeMarkersDialog::get_target_filepath(string path, string filename, string postfix)
{
- string target_path = path;
- if ((target_path.find_last_of ('/')) != string::npos) {
- target_path += '/';
- }
-
- string target_filepath = target_path + filename + postfix;
+ string target_filepath = Glib::build_filename (path, filename + postfix);
struct stat statbuf;
- for(int counter=1; (stat (target_filepath.c_str(), &statbuf) == 0); counter++){
+ for (int counter=1; Glib::file_test (target_filepath, Glib::FILE_TEST_EXISTS); counter++) {
// while file exists
ostringstream scounter;
scounter.flush();
scounter << counter;
- target_filepath =
- target_path + filename + "_" + scounter.str() + postfix;
+ target_filepath = Glib::build_filename (path, filename + "_" + scounter.str() + postfix);
}
return target_filepath;
diff --git a/gtk2_ardour/imageframe_socket_handler.cc b/gtk2_ardour/imageframe_socket_handler.cc
index 9279a177ee..363094990d 100644
--- a/gtk2_ardour/imageframe_socket_handler.cc
+++ b/gtk2_ardour/imageframe_socket_handler.cc
@@ -1616,12 +1616,7 @@ ImageFrameSocketHandler::handle_session_name_request(const char* msg)
std::string sessionName = currentSession->name() ;
std::string sessionPath = currentSession->path() ;
- if(sessionPath[sessionPath.length() -1] != '/')
- {
- sessionPath.append("/") ;
- }
-
- sessionPath.append(sessionName) ;
+ sessionPath = Glib::build_filename (sessionPath, sessionName);
std::ostringstream msgBuf ;
msgBuf << ardourvis::RETURN_DATA << ardourvis::SESSION_NAME ;
diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc
index d7f7539185..98ff6a2586 100644
--- a/gtk2_ardour/new_session_dialog.cc
+++ b/gtk2_ardour/new_session_dialog.cc
@@ -618,8 +618,8 @@ NewSessionDialog::set_session_folder(const Glib::ustring& dir)
std::string
NewSessionDialog::session_name() const
{
- std::string str = Glib::filename_from_utf8(m_open_filechooser->get_filename());
- std::string::size_type position = str.find_last_of ('/');
+ std::string str = Glib::filename_from_utf8 (m_open_filechooser->get_filename());
+ std::string::size_type position = str.find_last_of (G_DIR_SEPARATOR);
str = str.substr (position+1);
position = str.find_last_of ('.');
str = str.substr (0, position);
@@ -1073,9 +1073,9 @@ NewSessionDialog::reset_recent()
std::vector<const gchar*> item;
std::string fullpath = *(*i);
- /* remove any trailing / */
+ /* remove any trailing separator */
- if (fullpath[fullpath.length()-1] == '/') {
+ if (fullpath[fullpath.length()-1] == G_DIR_SEPARATOR) {
fullpath = fullpath.substr (0, fullpath.length()-1);
}
diff --git a/gtk2_ardour/opts.cc b/gtk2_ardour/opts.cc
index a6c90495a4..8183bd265f 100644
--- a/gtk2_ardour/opts.cc
+++ b/gtk2_ardour/opts.cc
@@ -73,7 +73,7 @@ int
ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
{
const char *optstring = "U:hSbvVnOdc:C:m:N:k:p:";
- const char *execname = strrchr (argv[0], '/');
+ const char *execname = strrchr (argv[0], G_DIR_SEPARATOR);
if (getenv ("ARDOUR_SAE")) {
menus_file = "ardour-sae.menus";