From efca18acf1e17be9932b375347ce95f733c2dc59 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 4 Mar 2010 20:45:14 +0000 Subject: Use portable path construction. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2518 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/DeprecatedLoader.cpp | 3 ++- src/engine/LV2Node.cpp | 2 +- src/engine/NodeFactory.cpp | 3 ++- src/shared/runtime_paths.cpp | 11 ++++++----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp index 35cbd05a..ac71a32d 100644 --- a/src/client/DeprecatedLoader.cpp +++ b/src/client/DeprecatedLoader.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include "raul/log.hpp" #include "raul/Path.hpp" #include "shared/LV2URIMap.hpp" @@ -571,7 +572,7 @@ DeprecatedLoader::load_subpatch(const string& base_filename, const Path& parent, } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) { initial_data.insert(make_pair(uris.ingen_polyphony, (int)poly)); } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"filename"))) { - filename = base_filename + "/" + (const char*)key; + filename = Glib::build_filename(base_filename, (const char*)key); } else { // Don't know what this tag is, add it as variable if (key != NULL && strlen((const char*)key) > 0) add_variable(initial_data, (const char*)cur->name, (const char*)key); diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp index b682ca4e..be16e76d 100644 --- a/src/engine/LV2Node.cpp +++ b/src/engine/LV2Node.cpp @@ -220,7 +220,7 @@ LV2Node::instantiate(BufferFactory& bufs) break; } - assert(port_name.find("/") == string::npos); + assert(port_name.find('/') == string::npos); port_path = path().child(port_name); diff --git a/src/engine/NodeFactory.cpp b/src/engine/NodeFactory.cpp index 87b54d81..5ff21c04 100644 --- a/src/engine/NodeFactory.cpp +++ b/src/engine/NodeFactory.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "redlandmm/World.hpp" #include "raul/log.hpp" #include "raul/Atom.hpp" @@ -223,7 +224,7 @@ NodeFactory::load_ladspa_plugins() if (!strcmp(pfile->d_name, ".") || !strcmp(pfile->d_name, "..")) continue; - const string lib_path = dir +"/"+ pfile->d_name; + const string lib_path = Glib::build_filename(dir, pfile->d_name); // Ignore stupid libtool files. Kludge alert. if (lib_path.substr(lib_path.length()-3) == ".la") diff --git a/src/shared/runtime_paths.cpp b/src/shared/runtime_paths.cpp index fe1923b7..f823c4e2 100644 --- a/src/shared/runtime_paths.cpp +++ b/src/shared/runtime_paths.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "ingen-config.h" #include "runtime_paths.hpp" @@ -45,8 +46,8 @@ set_bundle_path_from_code(void* function) #ifdef BUNDLE string bundle = bin_loc; - bundle = bundle.substr(0, bundle.find_last_of("/")); - bundle_path = bundle;; + bundle = bundle.substr(0, bundle.find_last_of(G_DIR_SEPARATOR)); + bundle_path = bundle; #endif } @@ -58,9 +59,9 @@ data_file_path(const std::string& name) { std::string ret; #ifdef BUNDLE - ret = bundle_path + "/" + INGEN_DATA_DIR + "/" + name; + ret = Glib::build_filename(bundle_path, Glib::build_path(INGEN_DATA_DIR, name)); #else - ret = std::string(INGEN_DATA_DIR) + "/" + name; + ret = Glib::build_filename(INGEN_DATA_DIR, name); #endif return ret; } @@ -73,7 +74,7 @@ module_path(const std::string& name) { std::string ret; #ifdef BUNDLE - ret = Glib::Module::build_path(bundle_path + "/" + INGEN_MODULE_DIR, name); + ret = Glib::Module::build_path(Glib::build_path(bundle_path, INGEN_MODULE_DIR), name); #else ret = Glib::Module::build_path(INGEN_MODULE_DIR, name); #endif -- cgit v1.2.1