From 6b1cd681048a05b5f5d667b9b082a20538e98b5c Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Sun, 17 Jun 2007 00:52:51 +0000 Subject: [PATCH] Use ARDOUR::system/user_template_directory in NewSessionDialog for portability git-svn-id: svn://localhost/ardour2/trunk@2016 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/new_session_dialog.cc | 34 +++++++++++++------------------ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc index 6e01956e36..43f98a5271 100644 --- a/gtk2_ardour/new_session_dialog.cc +++ b/gtk2_ardour/new_session_dialog.cc @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -36,6 +36,8 @@ #include using namespace Gtkmm2ext; +using namespace ARDOUR; +using namespace PBD; #include "opts.h" @@ -364,26 +366,18 @@ NewSessionDialog::NewSessionDialog() m_treeview->set_headers_visible (false); m_treeview->get_selection()->set_mode (Gtk::SELECTION_SINGLE); - std::string path = ARDOUR::get_user_ardour_path(); - - if (path.empty()) { - path = ARDOUR::get_system_data_path(); - } - - if (!path.empty()) { - string user_template_path = path + ARDOUR::templates_dir_name; - - if (Glib::file_test(user_template_path, Glib::FILE_TEST_IS_DIR)) - { - m_template->set_current_folder (user_template_path); - } - } - - const std::string sys_templates_dir = ARDOUR::get_system_data_path() + ARDOUR::templates_dir_name; - - if (Glib::file_test(sys_templates_dir, Glib::FILE_TEST_IS_DIR)) + if (is_directory (user_template_directory ())) { - m_template->add_shortcut_folder(sys_templates_dir); + m_template->set_current_folder (user_template_directory().to_string()); + } + else if (is_directory (system_template_directory ())) + { + m_template->set_current_folder (system_template_directory().to_string()); + } + + if (is_directory (system_template_directory ())) + { + m_template->add_shortcut_folder (system_template_directory().to_string()); } m_template->set_title(_("select template"));