summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2012-06-23 05:06:54 +0000
committerTim Mayberry <mojofunk@gmail.com>2012-06-23 05:06:54 +0000
commit105caf23daf5aed16c7ee8b904fcca2ddbd4f59f (patch)
tree4d74f6c8722790e6fb9d58888ea225866fc98d3c /libs/ardour
parent22e478e7fc4952dd386391e85d8e7fa2491ae953 (diff)
Use std::string instead of PBD::sys::path in pbd/search_path.h, pbd/file_utils.h and ardour/session_dir.h
git-svn-id: svn://localhost/ardour2/branches/3.0@12829 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/export_profile_manager.h3
-rw-r--r--libs/ardour/ardour/filesystem_paths.h5
-rw-r--r--libs/ardour/ardour/session_directory.h29
-rw-r--r--libs/ardour/ardour/session_state_utils.h6
-rw-r--r--libs/ardour/audio_library.cc1
-rw-r--r--libs/ardour/audio_playlist_source.cc2
-rw-r--r--libs/ardour/audio_region_importer.cc10
-rw-r--r--libs/ardour/callback.cc6
-rw-r--r--libs/ardour/control_protocol_manager.cc6
-rw-r--r--libs/ardour/control_protocol_search_path.cc11
-rw-r--r--libs/ardour/export_filename.cc6
-rw-r--r--libs/ardour/export_formats_search_path.cc13
-rw-r--r--libs/ardour/export_profile_manager.cc13
-rw-r--r--libs/ardour/filesystem_paths.cc13
-rw-r--r--libs/ardour/globals.cc9
-rw-r--r--libs/ardour/import.cc2
-rw-r--r--libs/ardour/midi_patch_manager.cc23
-rw-r--r--libs/ardour/midi_source.cc4
-rw-r--r--libs/ardour/panner_manager.cc6
-rw-r--r--libs/ardour/panner_search_path.cc11
-rw-r--r--libs/ardour/plugin_manager.cc1
-rw-r--r--libs/ardour/rc_configuration.cc10
-rw-r--r--libs/ardour/recent_sessions.cc1
-rw-r--r--libs/ardour/session.cc22
-rw-r--r--libs/ardour/session_directory.cc75
-rw-r--r--libs/ardour/session_state.cc38
-rw-r--r--libs/ardour/session_state_utils.cc6
-rw-r--r--libs/ardour/session_utils.cc21
-rw-r--r--libs/ardour/vst_plugin.cc1
29 files changed, 154 insertions, 200 deletions
diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h
index f73085e5ba..0b8f7e9422 100644
--- a/libs/ardour/ardour/export_profile_manager.h
+++ b/libs/ardour/ardour/export_profile_manager.h
@@ -32,6 +32,7 @@
#include "pbd/uuid.h"
#include "pbd/file_utils.h"
#include "pbd/xml++.h"
+#include "pbd/filesystem.h"
#include "ardour/filesystem_paths.h"
#include "ardour/location.h"
@@ -90,7 +91,7 @@ class ExportProfileManager
ExportPresetPtr current_preset;
FileMap preset_file_map;
- std::vector<PBD::sys::path> find_file (std::string const & pattern);
+ std::vector<std::string> find_file (std::string const & pattern);
PBD::sys::path export_config_dir;
PBD::SearchPath search_path;
diff --git a/libs/ardour/ardour/filesystem_paths.h b/libs/ardour/ardour/filesystem_paths.h
index 120ae25f97..c8b01b79c3 100644
--- a/libs/ardour/ardour/filesystem_paths.h
+++ b/libs/ardour/ardour/filesystem_paths.h
@@ -20,7 +20,6 @@
#ifndef ARDOUR_FILESYSTEM_PATHS_INCLUDED
#define ARDOUR_FILESYSTEM_PATHS_INCLUDED
-#include "pbd/filesystem.h"
#include "pbd/search_path.h"
namespace ARDOUR {
@@ -29,13 +28,13 @@ namespace ARDOUR {
* @return the path to the directory used to store user specific ardour
* configuration files.
*/
- PBD::sys::path user_config_directory ();
+ std::string user_config_directory ();
/**
* @return the path to the directory that contains the system wide ardour
* modules.
*/
- PBD::sys::path ardour_dll_directory ();
+ std::string ardour_dll_directory ();
/**
* @return the search path to be used when looking for per-system
diff --git a/libs/ardour/ardour/session_directory.h b/libs/ardour/ardour/session_directory.h
index 1972aa4039..3f6d5d5e7c 100644
--- a/libs/ardour/ardour/session_directory.h
+++ b/libs/ardour/ardour/session_directory.h
@@ -22,8 +22,6 @@
#include <string>
#include <vector>
-#include "pbd/filesystem.h"
-
namespace ARDOUR {
class SessionDirectory
@@ -33,7 +31,7 @@ public:
/**
* @param session_path An absolute path to a session directory.
*/
- SessionDirectory (const PBD::sys::path& session_path);
+ SessionDirectory (const std::string& session_path);
/**
* Change the root path of this SessionDirectory object
@@ -43,7 +41,7 @@ public:
/**
* @return the absolute path to the root directory of the session
*/
- const PBD::sys::path root_path() const { return m_root_path; }
+ const std::string root_path() const { return m_root_path; }
/**
* @return the absolute path to the directory in which
@@ -54,40 +52,40 @@ public:
* directory otherwise it will return the new location
* of root_path()/interchange/session_name/audiofiles
*/
- const PBD::sys::path sound_path () const;
+ const std::string sound_path () const;
/**
* @return the absolute path to the directory in which
* the session stores MIDI files, ie
* root_path()/interchange/session_name/midifiles
*/
- const PBD::sys::path midi_path () const;
+ const std::string midi_path () const;
/**
* @return the absolute path to the directory in which
* the session stores MIDNAM patch files, ie
* root_path()/interchange/session_name/patchfiles
*/
- const PBD::sys::path midi_patch_path () const;
+ const std::string midi_patch_path () const;
/**
* @return The absolute path to the directory in which all
* peak files are stored for a session.
*/
- const PBD::sys::path peak_path () const;
+ const std::string peak_path () const;
/**
* @return The absolute path to the directory that source
* files are moved to when they are no longer part of the
* session.
*/
- const PBD::sys::path dead_path () const;
+ const std::string dead_path () const;
/**
* @return The absolute path to the directory that audio
* files are created in by default when exporting.
*/
- const PBD::sys::path export_path () const;
+ const std::string export_path () const;
/**
* @return true if session directory and all the required
@@ -98,9 +96,6 @@ public:
/**
* Create the session directory and all the subdirectories.
*
- * @throw PBD::sys::filesystem_error if the directories were
- * not able to be created.
- *
* @return true If a new session directory was created, otherwise
* (if it already existed) false.
*
@@ -113,7 +108,7 @@ public:
* are created for different source types.
* i.e root_path()/interchange/session_name
*/
- const PBD::sys::path sources_root() const;
+ const std::string sources_root() const;
private:
@@ -121,15 +116,15 @@ private:
* @return The path to the old style sound directory.
* It isn't created by create().
*/
- const PBD::sys::path old_sound_path () const;
+ const std::string old_sound_path () const;
/**
* @return a vector containing the fullpath of all subdirectories.
*/
- const std::vector<PBD::sys::path> sub_directories () const;
+ const std::vector<std::string> sub_directories () const;
/// The path to the root of the session directory.
- PBD::sys::path m_root_path;
+ std::string m_root_path;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/session_state_utils.h b/libs/ardour/ardour/session_state_utils.h
index de58d3eff0..57fcf54ac4 100644
--- a/libs/ardour/ardour/session_state_utils.h
+++ b/libs/ardour/ardour/session_state_utils.h
@@ -43,8 +43,8 @@ bool create_backup_file (const PBD::sys::path & file_path);
* @param directory_path The absolute path to a directory.
* @param result vector to contain resulting state files.
*/
-void get_state_files_in_directory (const PBD::sys::path & directory_path,
- std::vector<PBD::sys::path>& result);
+void get_state_files_in_directory (const std::string& directory_path,
+ std::vector<std::string>& result);
/**
* Given a vector of paths to files, return a vector containing
@@ -54,7 +54,7 @@ void get_state_files_in_directory (const PBD::sys::path & directory_path,
* @return a vector containing a list of file names without any
* filename extension.
*/
-std::vector<std::string> get_file_names_no_extension (const std::vector<PBD::sys::path> & file_paths);
+std::vector<std::string> get_file_names_no_extension (const std::vector<std::string> & file_paths);
} // namespace ARDOUR
diff --git a/libs/ardour/audio_library.cc b/libs/ardour/audio_library.cc
index 662b8cb33e..4fdbc708ad 100644
--- a/libs/ardour/audio_library.cc
+++ b/libs/ardour/audio_library.cc
@@ -27,6 +27,7 @@
#include <glibmm/convert.h>
#include "pbd/compose.h"
+#include "pbd/filesystem.h"
#include "ardour/audio_library.h"
#include "ardour/utils.h"
diff --git a/libs/ardour/audio_playlist_source.cc b/libs/ardour/audio_playlist_source.cc
index 4ba820d716..ea09d20056 100644
--- a/libs/ardour/audio_playlist_source.cc
+++ b/libs/ardour/audio_playlist_source.cc
@@ -212,7 +212,7 @@ AudioPlaylistSource::sample_rate () const
int
AudioPlaylistSource::setup_peakfile ()
{
- _peak_path = Glib::build_filename (_session.session_directory().peak_path().to_string(), name() + ARDOUR::peakfile_suffix);
+ _peak_path = Glib::build_filename (_session.session_directory().peak_path(), name() + ARDOUR::peakfile_suffix);
return initialize_peakfile (false, string());
}
diff --git a/libs/ardour/audio_region_importer.cc b/libs/ardour/audio_region_importer.cc
index c4755ec1f5..d1a1da718e 100644
--- a/libs/ardour/audio_region_importer.cc
+++ b/libs/ardour/audio_region_importer.cc
@@ -22,6 +22,8 @@
#include <sstream>
+#include <glibmm/miscutils.h>
+
#include "pbd/failed_constructor.h"
#include "pbd/compose.h"
#include "pbd/error.h"
@@ -292,12 +294,8 @@ AudioRegionImporter::parse_source_xml ()
PBD::sys::path
AudioRegionImporter::get_sound_dir (XMLTree const & tree)
{
- PBD::sys::path source_dir = tree.filename();
- source_dir = source_dir.branch_path();
- SessionDirectory session_dir(source_dir);
- source_dir = session_dir.sound_path();
-
- return source_dir;
+ SessionDirectory session_dir(Glib::path_get_dirname (tree.filename()));
+ return session_dir.sound_path();
}
void
diff --git a/libs/ardour/callback.cc b/libs/ardour/callback.cc
index 37442fce0c..6842755191 100644
--- a/libs/ardour/callback.cc
+++ b/libs/ardour/callback.cc
@@ -52,7 +52,7 @@ watermark ()
void
block_mothership ()
{
- string hangup = Glib::build_filename (ARDOUR::user_config_directory().to_string(), OFF_THE_HOOK);
+ string hangup = Glib::build_filename (ARDOUR::user_config_directory(), OFF_THE_HOOK);
int fd;
if ((fd = ::open (hangup.c_str(), O_RDWR|O_CREAT, 0600)) >= 0) {
close (fd);
@@ -62,14 +62,14 @@ block_mothership ()
void
unblock_mothership ()
{
- string hangup = Glib::build_filename (ARDOUR::user_config_directory().to_string(), OFF_THE_HOOK);
+ string hangup = Glib::build_filename (ARDOUR::user_config_directory(), OFF_THE_HOOK);
::unlink (hangup.c_str());
}
bool
mothership_blocked ()
{
- string hangup = Glib::build_filename (ARDOUR::user_config_directory().to_string(), OFF_THE_HOOK);
+ string hangup = Glib::build_filename (ARDOUR::user_config_directory(), OFF_THE_HOOK);
return Glib::file_test (hangup, Glib::FILE_TEST_EXISTS);
}
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc
index 475781f3c5..509f883aed 100644
--- a/libs/ardour/control_protocol_manager.cc
+++ b/libs/ardour/control_protocol_manager.cc
@@ -197,7 +197,7 @@ ControlProtocolManager::load_mandatory_protocols ()
void
ControlProtocolManager::discover_control_protocols ()
{
- vector<sys::path> cp_modules;
+ vector<std::string> cp_modules;
Glib::PatternSpec so_extension_pattern("*.so");
Glib::PatternSpec dylib_extension_pattern("*.dylib");
@@ -211,8 +211,8 @@ ControlProtocolManager::discover_control_protocols ()
DEBUG_TRACE (DEBUG::ControlProtocols,
string_compose (_("looking for control protocols in %1\n"), control_protocol_search_path().to_string()));
- for (vector<sys::path>::iterator i = cp_modules.begin(); i != cp_modules.end(); ++i) {
- control_protocol_discover ((*i).to_string());
+ for (vector<std::string>::iterator i = cp_modules.begin(); i != cp_modules.end(); ++i) {
+ control_protocol_discover (*i);
}
}
diff --git a/libs/ardour/control_protocol_search_path.cc b/libs/ardour/control_protocol_search_path.cc
index 157531cbf2..254cd03fe9 100644
--- a/libs/ardour/control_protocol_search_path.cc
+++ b/libs/ardour/control_protocol_search_path.cc
@@ -36,18 +36,11 @@ namespace ARDOUR {
SearchPath
control_protocol_search_path ()
{
- SearchPath spath (user_config_directory ());
-
+ SearchPath spath(user_config_directory ());
spath += ardour_dll_directory ();
spath.add_subdirectory_to_paths (surfaces_dir_name);
-
- bool surfaces_path_defined = false;
- SearchPath spath_env (Glib::getenv(surfaces_env_variable_name, surfaces_path_defined));
- if (surfaces_path_defined) {
- spath += spath_env;
- }
-
+ spath += SearchPath(Glib::getenv(surfaces_env_variable_name));
return spath;
}
diff --git a/libs/ardour/export_filename.cc b/libs/ardour/export_filename.cc
index f53dfbcbf6..3b8c27bc07 100644
--- a/libs/ardour/export_filename.cc
+++ b/libs/ardour/export_filename.cc
@@ -56,7 +56,7 @@ ExportFilename::ExportFilename (Session & session) :
std::time (&rawtime);
time_struct = localtime (&rawtime);
- folder = session.session_directory().export_path().to_string();
+ folder = session.session_directory().export_path();
XMLNode * instant_node = session.instant_xml ("ExportFilename");
if (instant_node) {
@@ -102,7 +102,7 @@ ExportFilename::set_state (const XMLNode & node)
if ((prop = child->property ("relative"))) {
if (!prop->value().compare ("true")) {
- folder = session.session_directory().root_path().to_string();
+ folder = session.session_directory().root_path();
}
}
@@ -345,7 +345,7 @@ ExportFilename::analyse_folder ()
{
FieldPair pair;
- string session_dir = session.session_directory().root_path().to_string();
+ string session_dir = session.session_directory().root_path();
string::size_type session_dir_len = session_dir.length();
string folder_beginning = folder.substr (0, session_dir_len);
diff --git a/libs/ardour/export_formats_search_path.cc b/libs/ardour/export_formats_search_path.cc
index 39ccb0de13..ed87a56e1a 100644
--- a/libs/ardour/export_formats_search_path.cc
+++ b/libs/ardour/export_formats_search_path.cc
@@ -36,17 +36,8 @@ SearchPath
export_formats_search_path ()
{
SearchPath spath;
-
- spath = user_config_directory ();
- spath.add_subdirectory_to_paths (export_formats_dir_name);
-
- bool export_path_defined = false;
- SearchPath spath_env = Glib::getenv (export_env_variable_name, export_path_defined);
-
- if (export_path_defined) {
- spath += spath_env;
- }
-
+ spath += Glib::build_filename (user_config_directory (), export_formats_dir_name);
+ spath += SearchPath(Glib::getenv (export_env_variable_name));
return spath;
}
diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc
index 54779cfa32..2fa0b7c76f 100644
--- a/libs/ardour/export_profile_manager.cc
+++ b/libs/ardour/export_profile_manager.cc
@@ -26,6 +26,7 @@
#include "pbd/enumwriter.h"
#include "pbd/xml++.h"
#include "pbd/convert.h"
+#include "pbd/filesystem.h"
#include "ardour/export_profile_manager.h"
#include "ardour/export_format_specification.h"
@@ -165,9 +166,9 @@ ExportProfileManager::load_preset (ExportPresetPtr preset)
void
ExportProfileManager::load_presets ()
{
- vector<sys::path> found = find_file (string_compose (X_("*%1"),export_preset_suffix));
+ vector<std::string> found = find_file (string_compose (X_("*%1"),export_preset_suffix));
- for (vector<sys::path>::iterator it = found.begin(); it != found.end(); ++it) {
+ for (vector<std::string>::iterator it = found.begin(); it != found.end(); ++it) {
load_preset_from_disk (*it);
}
}
@@ -300,10 +301,10 @@ ExportProfileManager::serialize_local_profile (XMLNode & root)
}
}
-std::vector<sys::path>
+std::vector<std::string>
ExportProfileManager::find_file (std::string const & pattern)
{
- vector<sys::path> found;
+ vector<std::string> found;
Glib::PatternSpec pattern_spec (pattern);
find_matching_files_in_search_path (search_path, pattern_spec, found);
@@ -669,9 +670,9 @@ ExportProfileManager::serialize_format (FormatStatePtr state)
void
ExportProfileManager::load_formats ()
{
- vector<sys::path> found = find_file (string_compose ("*%1", export_format_suffix));
+ vector<std::string> found = find_file (string_compose ("*%1", export_format_suffix));
- for (vector<sys::path>::iterator it = found.begin(); it != found.end(); ++it) {
+ for (vector<std::string>::iterator it = found.begin(); it != found.end(); ++it) {
load_format_from_disk (*it);
}
}
diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc
index 760b16c409..834b1b3331 100644
--- a/libs/ardour/filesystem_paths.cc
+++ b/libs/ardour/filesystem_paths.cc
@@ -22,6 +22,7 @@
#include "pbd/error.h"
#include "pbd/compose.h"
#include "pbd/strsplit.h"
+#include "pbd/filesystem.h"
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
@@ -37,7 +38,7 @@ namespace ARDOUR {
using std::string;
-sys::path
+std::string
user_config_directory ()
{
sys::path p;
@@ -87,10 +88,10 @@ user_config_directory ()
exit (1);
}
- return p;
+ return p.to_string();
}
-sys::path
+std::string
ardour_dll_directory ()
{
std::string s = Glib::getenv("ARDOUR_DLL_PATH");
@@ -98,7 +99,7 @@ ardour_dll_directory ()
std::cerr << _("ARDOUR_DLL_PATH not set in environment - exiting\n");
::exit (1);
}
- return sys::path (s);
+ return s;
}
SearchPath
@@ -119,7 +120,7 @@ ardour_config_search_path ()
std::vector<string> ss;
split (s, ss, ':');
for (std::vector<string>::iterator i = ss.begin(); i != ss.end(); ++i) {
- sp += sys::path (*i);
+ sp += *i;
}
search_path = sp;
@@ -147,7 +148,7 @@ ardour_data_search_path ()
std::vector<string> ss;
split (s, ss, ':');
for (std::vector<string>::iterator i = ss.begin(); i != ss.end(); ++i) {
- sp += sys::path (*i);
+ sp += *i;
}
search_path = sp;
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 1c6b98155c..5cd52b67c0 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -56,6 +56,7 @@
#include "pbd/fpu.h"
#include "pbd/file_utils.h"
#include "pbd/enumwriter.h"
+#include "pbd/filesystem.h"
#include "midi++/port.h"
#include "midi++/manager.h"
@@ -356,7 +357,7 @@ ARDOUR::cleanup ()
void
ARDOUR::find_bindings_files (map<string,string>& files)
{
- vector<sys::path> found;
+ vector<std::string> found;
SearchPath spath = ardour_config_search_path();
if (getenv ("ARDOUR_SAE")) {
@@ -371,8 +372,8 @@ ARDOUR::find_bindings_files (map<string,string>& files)
return;
}
- for (vector<sys::path>::iterator x = found.begin(); x != found.end(); ++x) {
- sys::path path = *x;
+ for (vector<std::string>::iterator x = found.begin(); x != found.end(); ++x) {
+ sys::path path(*x);
pair<string,string> namepath;
namepath.second = path.to_string();
namepath.first = path.leaf().substr (0, path.leaf().find_first_of ('.'));
@@ -453,7 +454,7 @@ ARDOUR::setup_fpu ()
string
ARDOUR::translation_kill_path ()
{
- return Glib::build_filename (user_config_directory().to_string(), ".love_is_the_language_of_audio");
+ return Glib::build_filename (user_config_directory(), ".love_is_the_language_of_audio");
}
bool
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc
index 2ae51cd471..b47b99571b 100644
--- a/libs/ardour/import.cc
+++ b/libs/ardour/import.cc
@@ -184,7 +184,7 @@ get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const st
const DataType type = SMFSource::safe_midi_file_extension (import_file_path) ? DataType::MIDI : DataType::AUDIO;
std::string filepath = (type == DataType::MIDI)
- ? sdir.midi_path().to_string() : sdir.sound_path().to_string();
+ ? sdir.midi_path() : sdir.sound_path();
filepath = Glib::build_filename (filepath,
get_non_existent_filename (hf, type, allow_replacing, filepath, basename, n, channels));
diff --git a/libs/ardour/midi_patch_manager.cc b/libs/ardour/midi_patch_manager.cc
index 58e33d2d53..ac57ae93c6 100644
--- a/libs/ardour/midi_patch_manager.cc
+++ b/libs/ardour/midi_patch_manager.cc
@@ -20,6 +20,8 @@
#include <boost/shared_ptr.hpp>
+#include <glibmm/fileutils.h>
+
#include "pbd/file_utils.h"
#include "pbd/error.h"
@@ -33,7 +35,6 @@ using namespace ARDOUR;
using namespace MIDI;
using namespace MIDI::Name;
using namespace PBD;
-using namespace PBD::sys;
MidiPatchManager* MidiPatchManager::_manager = 0;
@@ -56,23 +57,23 @@ MidiPatchManager::add_session_patches ()
return;
}
- path path_to_patches = _session->session_directory().midi_patch_path();
+ std::string path_to_patches = _session->session_directory().midi_patch_path();
- if (!exists (path_to_patches)) {
+ if (!Glib::file_test (path_to_patches, Glib::FILE_TEST_EXISTS)) {
return;
}
- assert(is_directory(path_to_patches));
+ assert (Glib::file_test (path_to_patches, Glib::FILE_TEST_IS_DIR));
Glib::PatternSpec pattern(string("*.midnam"));
- vector<path> result;
+ vector<std::string> result;
find_matching_files_in_directory (path_to_patches, pattern, result);
- info << "Loading " << result.size() << " MIDI patches from " << path_to_patches.to_string() << endmsg;
+ info << "Loading " << result.size() << " MIDI patches from " << path_to_patches << endmsg;
- for (vector<path>::iterator i = result.begin(); i != result.end(); ++i) {
- boost::shared_ptr<MIDINameDocument> document(new MIDINameDocument(i->to_string()));
+ for (vector<std::string>::iterator i = result.begin(); i != result.end(); ++i) {
+ boost::shared_ptr<MIDINameDocument> document(new MIDINameDocument(*i));
for (MIDINameDocument::MasterDeviceNamesList::const_iterator device =
document->master_device_names_by_model().begin();
device != document->master_device_names_by_model().end();
@@ -101,14 +102,14 @@ MidiPatchManager::refresh()
SearchPath search_path = midi_patch_search_path ();
Glib::PatternSpec pattern (string("*.midnam"));
- vector<path> result;
+ vector<std::string> result;
find_matching_files_in_search_path (search_path, pattern, result);
info << "Loading " << result.size() << " MIDI patches from " << search_path.to_string() << endmsg;
- for (vector<path>::iterator i = result.begin(); i != result.end(); ++i) {
- boost::shared_ptr<MIDINameDocument> document(new MIDINameDocument(i->to_string()));
+ for (vector<std::string>::iterator i = result.begin(); i != result.end(); ++i) {
+ boost::shared_ptr<MIDINameDocument> document(new MIDINameDocument(*i));
for (MIDINameDocument::MasterDeviceNamesList::const_iterator device =
document->master_device_names_by_model().begin();
device != document->master_device_names_by_model().end();
diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc
index 48d9cdf877..6c6821d773 100644
--- a/libs/ardour/midi_source.cc
+++ b/libs/ardour/midi_source.cc
@@ -29,6 +29,7 @@
#include <algorithm>
#include <glibmm/fileutils.h>
+#include <glibmm/miscutils.h>
#include "pbd/xml++.h"
#include "pbd/pthread_utils.h"
@@ -339,8 +340,7 @@ MidiSource::clone (const string& path, Evoral::MusicalTime begin, Evoral::Musica
do {
newname = bump_name_once (newname, '-');
- /* XXX build path safely */
- newpath = _session.session_directory().midi_path().to_string() +"/"+ newname + ".mid";
+ newpath = Glib::build_filename (_session.session_directory().midi_path(), newname + ".mid");
} while (Glib::file_test (newpath, Glib::FILE_TEST_EXISTS));
} else {
diff --git a/libs/ardour/panner_manager.cc b/libs/ardour/panner_manager.cc
index 691a8f31ee..c3601d41de 100644
--- a/libs/ardour/panner_manager.cc
+++ b/libs/ardour/panner_manager.cc
@@ -62,7 +62,7 @@ PannerManager::instance ()
void
PannerManager::discover_panners ()
{
- vector<sys::path> panner_modules;
+ vector<std::string> panner_modules;
Glib::PatternSpec so_extension_pattern("*.so");
Glib::PatternSpec dylib_extension_pattern("*.dylib");
@@ -75,8 +75,8 @@ PannerManager::discover_panners ()
DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for panners in %1"), panner_search_path().to_string()));
- for (vector<sys::path>::iterator i = panner_modules.begin(); i != panner_modules.end(); ++i) {
- panner_discover ((*i).to_string());
+ for (vector<std::string>::iterator i = panner_modules.begin(); i != panner_modules.end(); ++i) {
+ panner_discover (*i);
}
}
int
diff --git a/libs/ardour/panner_search_path.cc b/libs/ardour/panner_search_path.cc
index debc19c757..63802ffc4e 100644
--- a/libs/ardour/panner_search_path.cc
+++ b/libs/ardour/panner_search_path.cc
@@ -34,18 +34,11 @@ namespace ARDOUR {
SearchPath
panner_search_path ()
{
- SearchPath spath (user_config_directory ());
-
+ SearchPath spath(user_config_directory ());
spath += ardour_dll_directory ();
spath.add_subdirectory_to_paths(panner_dir_name);
- bool panner_path_defined = false;
- SearchPath spath_env (Glib::getenv(panner_env_variable_name, panner_path_defined));
-
- if (panner_path_defined) {
- spath += spath_env;
- }
-
+ spath += SearchPath(Glib::getenv(panner_env_variable_name));
return spath;
}
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc
index a666e7b53e..d60849a67f 100644
--- a/libs/ardour/plugin_manager.cc
+++ b/libs/ardour/plugin_manager.cc
@@ -46,6 +46,7 @@
#include "pbd/pathscanner.h"
#include "pbd/whitespace.h"
+#include "pbd/filesystem.h"
#include "ardour/debug.h"
#include "ardour/filesystem_paths.h"
diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc
index d2290c73d5..f0723d46ad 100644
--- a/libs/ardour/rc_configuration.cc
+++ b/libs/ardour/rc_configuration.cc
@@ -77,13 +77,12 @@ RCConfiguration::~RCConfiguration ()
int
RCConfiguration::load_state ()
{
- sys::path system_rc_file;
+ std::string rcfile;
struct stat statbuf;
/* load system configuration first */
- if (find_file_in_search_path (ardour_config_search_path(), "ardour_system.rc", system_rc_file)) {
- string rcfile = system_rc_file.to_string();
+ if (find_file_in_search_path (ardour_config_search_path(), "ardour_system.rc", rcfile)) {
/* stupid XML Parser hates empty files */
@@ -111,10 +110,7 @@ RCConfiguration::load_state ()
/* now load configuration file for user */
- sys::path user_rc_file;
-
- if (find_file_in_search_path (ardour_config_search_path(), "ardour.rc", user_rc_file)) {
- string rcfile = user_rc_file.to_string();
+ if (find_file_in_search_path (ardour_config_search_path(), "ardour.rc", rcfile)) {
/* stupid XML parser hates empty files */
diff --git a/libs/ardour/recent_sessions.cc b/libs/ardour/recent_sessions.cc
index b1bf49f7ad..843ea0742f 100644
--- a/libs/ardour/recent_sessions.cc
+++ b/libs/ardour/recent_sessions.cc
@@ -23,6 +23,7 @@
#include <algorithm>
#include "pbd/error.h"
+#include "pbd/filesystem.h"
#include "ardour/rc_configuration.h"
#include "ardour/filesystem_paths.h"
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index be84ed4e53..a6a9041ab1 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -47,6 +47,7 @@
#include "pbd/strsplit.h"
#include "pbd/strsplit.h"
#include "pbd/unwind.h"
+#include "pbd/filesystem.h"
#include "ardour/amp.h"
#include "ardour/analyser.h"
@@ -3199,7 +3200,7 @@ Session::new_source_path_from_name (DataType type, const string& name)
SessionDirectory sdir(get_best_session_directory_for_new_source());
- sys::path p;
+ std::string p;
if (type == DataType::AUDIO) {
p = sdir.sound_path();
} else if (type == DataType::MIDI) {
@@ -3209,16 +3210,13 @@ Session::new_source_path_from_name (DataType type, const string& name)
return "";
}
- p /= name;
- return p.to_string();
+ return Glib::build_filename (p, name);
}
string
Session::peak_path (string base) const
{
- sys::path peakfile_path(_session_dir->peak_path());
- peakfile_path /= base + peakfile_suffix;
- return peakfile_path.to_string();
+ return Glib::build_filename (_session_dir->peak_path(), base + peakfile_suffix);
}
/** Return a unique name based on \a base for a new internal audio source */
@@ -3282,7 +3280,7 @@ Session::new_audio_source_name (const string& base, uint32_t nchan, uint32_t cha
SessionDirectory sdir((*i).path);
- string spath = sdir.sound_path().to_string();
+ string spath = sdir.sound_path();
/* note that we search *without* the extension so that
we don't end up both "Audio 1-1.wav" and "Audio 1-1.caf"
@@ -3955,7 +3953,7 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
framepos_t to_do;
BufferSet buffers;
SessionDirectory sdir(get_best_session_directory_for_new_source ());
- const string sound_dir = sdir.sound_path().to_string();
+ const string sound_dir = sdir.sound_path();
framepos_t len = end - start;
bool need_block_size_reset = false;
string ext;
@@ -4441,10 +4439,10 @@ Session::source_search_path (DataType type) const
if (session_dirs.size() == 1) {
switch (type) {
case DataType::AUDIO:
- s.push_back ( _session_dir->sound_path().to_string());
+ s.push_back ( _session_dir->sound_path());
break;
case DataType::MIDI:
- s.push_back (_session_dir->midi_path().to_string());
+ s.push_back (_session_dir->midi_path());
break;
}
} else {
@@ -4452,10 +4450,10 @@ Session::source_search_path (DataType type) const
SessionDirectory sdir (i->path);
switch (type) {
case DataType::AUDIO:
- s.push_back (sdir.sound_path().to_string());
+ s.push_back (sdir.sound_path());
break;
case DataType::MIDI:
- s.push_back (sdir.midi_path().to_string());
+ s.push_back (sdir.midi_path());
break;
}
}
diff --git a/libs/ardour/session_directory.cc b/libs/ardour/session_directory.cc
index 9653a15ae1..fca3950669 100644
--- a/libs/ardour/session_directory.cc
+++ b/libs/ardour/session_directory.cc
@@ -16,6 +16,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/fileutils.h>
+#include <glibmm/miscutils.h>
+
#include "pbd/error.h"
#include "pbd/compose.h"
#include "pbd/filesystem.h"
@@ -31,7 +34,7 @@ namespace ARDOUR {
using namespace std;
using namespace PBD::sys;
-SessionDirectory::SessionDirectory (const path& session_path)
+SessionDirectory::SessionDirectory (const std::string& session_path)
: m_root_path(session_path)
{
@@ -49,20 +52,16 @@ SessionDirectory::create ()
{
bool is_new = false;
- vector<path> sub_dirs = sub_directories ();
- for (vector<path>::const_iterator i = sub_dirs.begin(); i != sub_dirs.end(); ++i)
+ vector<std::string> sub_dirs = sub_directories ();
+ for (vector<std::string>::const_iterator i = sub_dirs.begin(); i != sub_dirs.end(); ++i)
{
- try
- {
- if(create_directories(*i)) is_new = true;
+ if (Glib::file_test (*i, Glib::FILE_TEST_EXISTS)) {
+ is_new = false;
}
- catch (PBD::sys::filesystem_error& ex)
- {
- // log the error
- PBD::error << string_compose(_("Cannot create Session directory at path %1 Error: %2"), (*i).to_string(), ex.what()) << endmsg;
- // and rethrow
- throw ex;
+ if (g_mkdir_with_parents (i->c_str(), 0755) != 0) {
+ PBD::error << string_compose(_("Cannot create Session directory at path %1 Error: %2"), *i, g_strerror(errno)) << endmsg;
+
}
}
@@ -72,82 +71,84 @@ SessionDirectory::create ()
bool
SessionDirectory::is_valid () const
{
- if (!is_directory (m_root_path)) return false;
+ if (!Glib::file_test (m_root_path, Glib::FILE_TEST_IS_DIR)) return false;
- vector<path> sub_dirs = sub_directories ();
+ vector<std::string> sub_dirs = sub_directories ();
- for (vector<path>::iterator i = sub_dirs.begin(); i != sub_dirs.end(); ++i) {
- if (!is_directory (*i)) {
- PBD::warning << string_compose(_("Session subdirectory does not exist at path %1"), (*i).to_string()) << endmsg;
+ for (vector<std::string>::iterator i = sub_dirs.begin(); i != sub_dirs.end(); ++i) {
+ if (!Glib::file_test (*i, Glib::FILE_TEST_IS_DIR)) {
+ PBD::warning << string_compose(_("Session subdirectory does not exist at path %1"), *i) << endmsg;
return false;
}
}
return true;
}
-const path
+const std::string
SessionDirectory::old_sound_path () const
{
- return m_root_path / old_sound_dir_name;
+ return Glib::build_filename (m_root_path, old_sound_dir_name);
}
-const path
+const std::string
SessionDirectory::sources_root () const
{
+ // fix this later
path p = m_root_path;
if (p.leaf() == ".") {
p = PBD::sys::get_absolute_path (m_root_path);
}
-
+
const string legalized_root (legalize_for_path (p.leaf ()));
- return m_root_path / interchange_dir_name / legalized_root;
+ path sources_root_path = m_root_path / interchange_dir_name / legalized_root;
+ return sources_root_path.to_string ();
}
-const path
+const std::string
SessionDirectory::sound_path () const
{
- if(is_directory (old_sound_path ())) return old_sound_path();
+ if (Glib::file_test (old_sound_path (), Glib::FILE_TEST_IS_DIR)) return old_sound_path();
// the new style sound directory
- return sources_root() / sound_dir_name;
+ return Glib::build_filename (sources_root(), sound_dir_name);
}
-const path
+const std::string
SessionDirectory::midi_path () const
{
- return sources_root() / midi_dir_name;
+ return Glib::build_filename (sources_root(), midi_dir_name);
}
-const path
+const std::string
SessionDirectory::midi_patch_path () const
{
- return sources_root() / midi_patch_dir_name;
+ return Glib::build_filename (sources_root(), midi_patch_dir_name);
}
-const path
+const std::string
SessionDirectory::peak_path () const
{
- return m_root_path / peak_dir_name;
+ return Glib::build_filename (m_root_path, peak_dir_name);
}
-const path
+const std::string
SessionDirectory::dead_path () const
{
- return m_root_path / dead_dir_name;
+ return Glib::build_filename (m_root_path, dead_dir_name);
}
-const path
+const std::string
SessionDirectory::export_path () const
{
- return m_root_path / export_dir_name;
+ return Glib::build_filename (m_root_path, export_dir_name);
}
-const vector<path>
+const vector<std::string>
SessionDirectory::sub_directories () const
{
- vector<path> tmp_paths;
+ vector<std::string> tmp_paths;
tmp_paths.push_back (sound_path ());
tmp_paths.push_back (midi_path ());
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 05aea88a46..2abdc6f16b 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -288,7 +288,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
int
Session::second_stage_init ()
{
- AudioFileSource::set_peak_dir (_session_dir->peak_path().to_string());
+ AudioFileSource::set_peak_dir (_session_dir->peak_path());
if (!_is_new) {
if (load_state (_current_snapshot_name)) {
@@ -392,7 +392,7 @@ Session::raid_path () const
SearchPath raid_search_path;
for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
- raid_search_path += sys::path((*i).path);
+ raid_search_path += (*i).path;
}
return raid_search_path.to_string ();
@@ -415,7 +415,7 @@ Session::setup_raid_path (string path)
SearchPath midi_search_path;
for (SearchPath::const_iterator i = search_path.begin(); i != search_path.end(); ++i) {
- sp.path = (*i).to_string ();
+ sp.path = *i;
sp.blocks = 0; // not needed
session_dirs.push_back (sp);
@@ -445,35 +445,35 @@ Session::ensure_subdirs ()
{
string dir;
- dir = session_directory().peak_path().to_string();
+ dir = session_directory().peak_path();
if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
error << string_compose(_("Session: cannot create session peakfile folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
return -1;
}
- dir = session_directory().sound_path().to_string();
+ dir = session_directory().sound_path();
if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
error << string_compose(_("Session: cannot create session sounds dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
return -1;
}
- dir = session_directory().midi_path().to_string();
+ dir = session_directory().midi_path();
if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
error << string_compose(_("Session: cannot create session midi dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
return -1;
}
- dir = session_directory().dead_path().to_string();
+ dir = session_directory().dead_path();
if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
error << string_compose(_("Session: cannot create session dead sounds folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
return -1;
}
- dir = session_directory().export_path().to_string();
+ dir = session_directory().export_path();
if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
error << string_compose(_("Session: cannot create session export folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
@@ -656,8 +656,8 @@ Session::rename_state (string old_name, string new_name)
const string old_xml_filename = legalize_for_path (old_name) + statefile_suffix;
const string new_xml_filename = legalize_for_path (new_name) + statefile_suffix;
- const sys::path old_xml_path = _session_dir->root_path() / old_xml_filename;
- const sys::path new_xml_path = _session_dir->root_path() / new_xml_filename;
+ const sys::path old_xml_path(Glib::build_filename (_session_dir->root_path(), old_xml_filename));
+ const sys::path new_xml_path(Glib::build_filename (_session_dir->root_path(), new_xml_filename));
try
{
@@ -1226,7 +1226,7 @@ Session::set_state (const XMLNode& node, int version)
}
}
- setup_raid_path(_session_dir->root_path().to_string());
+ setup_raid_path(_session_dir->root_path());
if ((prop = node.property (X_("id-counter"))) != 0) {
uint64_t x;
@@ -2134,7 +2134,7 @@ string
Session::get_best_session_directory_for_new_source ()
{
vector<space_and_path>::iterator i;
- string result = _session_dir->root_path().to_string();
+ string result = _session_dir->root_path();
/* handle common case without system calls */
@@ -2750,7 +2750,7 @@ Session::cleanup_sources (CleanupReport& rep)
++nexti;
SessionDirectory sdir ((*i).path);
- audio_path += sdir.sound_path().to_string();
+ audio_path += sdir.sound_path();
if (nexti != session_dirs.end()) {
audio_path += ':';
@@ -2768,7 +2768,7 @@ Session::cleanup_sources (CleanupReport& rep)
++nexti;
SessionDirectory sdir ((*i).path);
- midi_path += sdir.midi_path().to_string();
+ midi_path += sdir.midi_path();
if (nexti != session_dirs.end()) {
midi_path += ':';
@@ -3252,8 +3252,8 @@ Session::save_history (string snapshot_name)
const string history_filename = legalize_for_path (snapshot_name) + history_suffix;
const string backup_filename = history_filename + backup_suffix;
- const sys::path xml_path = _session_dir->root_path() / history_filename;
- const sys::path backup_path = _session_dir->root_path() / backup_filename;
+ const sys::path xml_path(Glib::build_filename (_session_dir->root_path(), history_filename));
+ const sys::path backup_path(Glib::build_filename (_session_dir->root_path(), backup_filename));
if (sys::exists (xml_path)) {
try
@@ -3304,7 +3304,7 @@ Session::restore_history (string snapshot_name)
}
const string xml_filename = legalize_for_path (snapshot_name) + history_suffix;
- const sys::path xml_path = _session_dir->root_path() / xml_filename;
+ const sys::path xml_path(Glib::build_filename (_session_dir->root_path(), xml_filename));
info << "Loading history from " << xml_path.to_string() << endmsg;
@@ -3681,7 +3681,7 @@ Session::rename (const std::string& new_name)
string newstr;
bool first = true;
- string const old_sources_root = _session_dir->sources_root().to_string ();
+ string const old_sources_root = _session_dir->sources_root();
#define RENAME ::rename
@@ -3810,7 +3810,7 @@ Session::rename (const std::string& new_name)
boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (i->second);
if (fs) {
string p = fs->path ();
- boost::replace_all (p, old_sources_root, _session_dir->sources_root().to_string ());
+ boost::replace_all (p, old_sources_root, _session_dir->sources_root());
fs->set_path (p);
}
}
diff --git a/libs/ardour/session_state_utils.cc b/libs/ardour/session_state_utils.cc
index a855072413..8cfda28780 100644
--- a/libs/ardour/session_state_utils.cc
+++ b/libs/ardour/session_state_utils.cc
@@ -54,8 +54,8 @@ create_backup_file (const sys::path & file_path)
}
void
-get_state_files_in_directory (const sys::path & directory_path,
- vector<sys::path> & result)
+get_state_files_in_directory (const std::string & directory_path,
+ vector<std::string> & result)
{
Glib::PatternSpec state_file_pattern('*' + string(statefile_suffix));
@@ -64,7 +64,7 @@ get_state_files_in_directory (const sys::path & directory_path,
}
vector<string>
-get_file_names_no_extension (const vector<sys::path> & file_paths)
+get_file_names_no_extension (const vector<std::string> & file_paths)
{
vector<string> result;
diff --git a/libs/ardour/session_utils.cc b/libs/ardour/session_utils.cc
index 9c367a702f..7a833ac732 100644
--- a/libs/ardour/session_utils.cc
+++ b/libs/ardour/session_utils.cc
@@ -15,26 +15,7 @@ bool
create_session_directory (const string& session_directory_path)
{
SessionDirectory sdir(session_directory_path);
-
- try
- {
- // create all the required session directories
- sdir.create();
- }
- catch(sys::filesystem_error& ex)
- {
- // log the exception
- warning << string_compose
- (
- _("Unable to create session directory at path %1 : %2"),
- session_directory_path,
- ex.what()
- );
-
- return false;
- }
-
- // successfully created the session directory
+ sdir.create();
return true;
}
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index 84186fd672..0a3a939f3a 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -19,6 +19,7 @@
#include "pbd/locale_guard.h"
#include "pbd/pathscanner.h"
+#include "pbd/filesystem.h"
#include "ardour/vst_plugin.h"
#include "ardour/vestige/aeffectx.h"
#include "ardour/session.h"