Replace use of PBD::sys::path in ardour/template_utils.h
authorTim Mayberry <mojofunk@gmail.com>
Sat, 23 Jun 2012 05:07:05 +0000 (05:07 +0000)
committerTim Mayberry <mojofunk@gmail.com>
Sat, 23 Jun 2012 05:07:05 +0000 (05:07 +0000)
some associated changes from not including pbd/filesystem.h in template_utils.h

git-svn-id: svn://localhost/ardour2/branches/3.0@12833 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/route_ui.cc
gtk2_ardour/startup.cc
libs/ardour/ardour/template_utils.h
libs/ardour/session_state.cc
libs/ardour/template_utils.cc

index ff970bc5a1fb4bf8590544e8d315686497c70977..0da6bde4f08b072ad2a932ace50bc22db5158ab1 100644 (file)
@@ -1628,14 +1628,14 @@ RouteUI::adjust_latency ()
 void
 RouteUI::save_as_template ()
 {
-       sys::path path;
+       std::string path;
        std::string safe_name;
        string name;
 
        path = ARDOUR::user_route_template_directory ();
 
-       if (g_mkdir_with_parents (path.to_string().c_str(), 0755)) {
-               error << string_compose (_("Cannot create route template directory %1"), path.to_string()) << endmsg;
+       if (g_mkdir_with_parents (path.c_str(), 0755)) {
+               error << string_compose (_("Cannot create route template directory %1"), path) << endmsg;
                return;
        }
 
@@ -1657,9 +1657,9 @@ RouteUI::save_as_template ()
        safe_name = legalize_for_path (name);
        safe_name += template_suffix;
 
-       path /= safe_name;
+       path = Glib::build_filename (path, safe_name);
 
-       _route->save_as_template (path.to_string(), name);
+       _route->save_as_template (path, name);
 }
 
 void
index 26f4afafa074fc2ba50aaf1b1bbc5bf705714685..ee598b08cbc81466a1191fbba76a95349a5bb60f 100644 (file)
@@ -38,6 +38,7 @@
 #include "ardour/session.h"
 #include "ardour/session_state_utils.h"
 #include "ardour/template_utils.h"
+#include "ardour/filename_extensions.h"
 
 #include "ardour_ui.h"
 #include "startup.h"
@@ -246,8 +247,8 @@ std::string
 ArdourStartup::session_template_name ()
 {
        if (!load_template_override.empty()) {
-               string the_path = (ARDOUR::user_template_directory()/ (load_template_override + ".template")).to_string();
-               return the_path;
+               string the_path(ARDOUR::user_template_directory());
+               return Glib::build_filename (the_path, load_template_override + ARDOUR::template_suffix);
        }
 
        if (ic_existing_session_button.get_active()) {
index ec9fdaac8f17b069da687c80637ac68efe1e2dfd..a61dbcf15832955c434449b06662190f9c7e7f39 100644 (file)
@@ -2,17 +2,16 @@
 #ifndef TEMPLATE_UTILS_INCLUDED
 #define TEMPLATE_UTILS_INCLUDED
 
+#include <string>
 #include <vector>
 
-#include "pbd/filesystem.h"
-
 namespace ARDOUR {
 
-       PBD::sys::path system_template_directory ();
-       PBD::sys::path system_route_template_directory ();
+       std::string system_template_directory ();
+       std::string system_route_template_directory ();
 
-       PBD::sys::path user_template_directory ();
-       PBD::sys::path user_route_template_directory ();
+       std::string user_template_directory ();
+       std::string user_route_template_directory ();
 
        struct TemplateInfo {
                std::string name;
index 3656e0f07eac41370c5789b407f4267f916c29cc..c03be469cbc4990c4507296a53a2e9890088bee1 100644 (file)
@@ -68,6 +68,7 @@
 #include "pbd/controllable_descriptor.h"
 #include "pbd/enumwriter.h"
 #include "pbd/error.h"
+#include "pbd/filesystem.h"
 #include "pbd/pathscanner.h"
 #include "pbd/pthread_utils.h"
 #include "pbd/search_path.h"
index 3e4797dac1de8bbf361a531f07c11709e5481f4c..d0843b34cf853e8a2900e308c71ea4b67f4807c8 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <glibmm.h>
 
-#include "pbd/filesystem.h"
 #include "pbd/basename.h"
 #include "pbd/pathscanner.h"
 #include "pbd/xml++.h"
@@ -35,22 +34,16 @@ route_template_search_path ()
        return spath;
 }
 
-sys::path
+std::string
 user_template_directory ()
 {
-       sys::path p(user_config_directory());
-       p /= templates_dir_name;
-
-       return p;
+       return Glib::build_filename (user_config_directory(), templates_dir_name);
 }
 
-sys::path
+std::string
 user_route_template_directory ()
 {
-       sys::path p(user_config_directory());
-       p /= route_templates_dir_name;
-       
-       return p;
+       return Glib::build_filename (user_config_directory(), route_templates_dir_name);
 }
 
 static bool
@@ -76,10 +69,7 @@ route_template_filter (const string &str, void */*arg*/)
 string
 session_template_dir_to_file (string const & dir)
 {
-       sys::path dir_path = dir;
-       sys::path file_path = dir;
-       file_path /= dir_path.leaf() + template_suffix;
-       return file_path.to_string ();
+       return Glib::build_filename (dir, Glib::path_get_basename(dir) + template_suffix);
 }