diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2012-06-23 05:09:37 +0000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2012-06-23 05:09:37 +0000 |
commit | 9ae1ff59dc4461f2a22c37a780636b3f16e9a9c0 (patch) | |
tree | 19574d19bcee1b15901eadf1aeb30a80fbf5be57 /libs/ardour/session_state.cc | |
parent | 8bfeb96bfc460fe8df50d5def0a879a13d8fb61f (diff) |
Use std::string and Glib::build_filename in Session::save_template
git-svn-id: svn://localhost/ardour2/branches/3.0@12899 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 42040d29a1..81c399d2a2 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2028,53 +2028,54 @@ Session::save_template (string template_name) return -1; } - sys::path user_template_dir(user_template_directory()); + std::string user_template_dir(user_template_directory()); - if (g_mkdir_with_parents (user_template_dir.to_string().c_str(), 0755) != 0) { + if (g_mkdir_with_parents (user_template_dir.c_str(), 0755) != 0) { error << string_compose(_("Could not create templates directory \"%1\" (%2)"), - user_template_dir.to_string(), g_strerror (errno)) << endmsg; + user_template_dir, g_strerror (errno)) << endmsg; return -1; } tree.set_root (&get_template()); - sys::path template_dir_path(user_template_dir); + std::string template_dir_path(user_template_dir); /* directory to put the template in */ - template_dir_path /= template_name; - if (Glib::file_test (template_dir_path.to_string(), Glib::FILE_TEST_EXISTS)) { + template_dir_path = Glib::build_filename (template_dir_path, template_name); + + if (Glib::file_test (template_dir_path, Glib::FILE_TEST_EXISTS)) { warning << string_compose(_("Template \"%1\" already exists - new version not created"), - template_dir_path.to_string()) << endmsg; + template_dir_path) << endmsg; return -1; } - if (g_mkdir_with_parents (template_dir_path.to_string().c_str(), 0755) != 0) { + if (g_mkdir_with_parents (template_dir_path.c_str(), 0755) != 0) { error << string_compose(_("Could not create directory for Session template\"%1\" (%2)"), - template_dir_path.to_string(), g_strerror (errno)) << endmsg; + template_dir_path, g_strerror (errno)) << endmsg; return -1; } /* file to write */ - sys::path template_file_path = template_dir_path; - template_file_path /= template_name + template_suffix; + std::string template_file_path(template_dir_path); + template_file_path = Glib::build_filename (template_file_path, template_name + template_suffix); - if (!tree.write (template_file_path.to_string())) { + if (!tree.write (template_file_path)) { error << _("template not saved") << endmsg; return -1; } /* copy plugin state directory */ - sys::path template_plugin_state_path = template_dir_path; - template_plugin_state_path /= X_("plugins"); + std::string template_plugin_state_path(template_dir_path); + template_plugin_state_path = Glib::build_filename (template_plugin_state_path, X_("plugins")); - if (g_mkdir_with_parents (template_plugin_state_path.to_string().c_str(), 0755) != 0) { + if (g_mkdir_with_parents (template_plugin_state_path.c_str(), 0755) != 0) { error << string_compose(_("Could not create directory for Session template plugin state\"%1\" (%2)"), - template_plugin_state_path.to_string(), g_strerror (errno)) << endmsg; + template_plugin_state_path, g_strerror (errno)) << endmsg; return -1; } - copy_files (plugins_dir(), template_plugin_state_path.to_string()); + copy_files (plugins_dir(), template_plugin_state_path); return 0; } |