diff options
-rw-r--r-- | gtk2_ardour/startup.cc | 22 | ||||
-rw-r--r-- | gtk2_ardour/startup.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/filesystem_paths.h | 8 | ||||
-rw-r--r-- | libs/ardour/filesystem_paths.cc | 11 |
4 files changed, 35 insertions, 8 deletions
diff --git a/gtk2_ardour/startup.cc b/gtk2_ardour/startup.cc index b6af6ddb4c..d4c8686698 100644 --- a/gtk2_ardour/startup.cc +++ b/gtk2_ardour/startup.cc @@ -115,13 +115,23 @@ ArdourStartup::~ArdourStartup () bool ArdourStartup::required () { - return !Glib::file_test (been_here_before_path(), Glib::FILE_TEST_EXISTS); -} + /* look for a "been here before" file for this version or earlier + * versions + */ -std::string -ArdourStartup::been_here_before_path () -{ - return Glib::build_filename (user_config_directory (), ".a" PROGRAM_VERSION); + const int current_version = atoi (PROGRAM_VERSION); + + for (int v = current_version; v != 0; --v) { + if (Glib::file_test (ARDOUR::been_here_before_path (v), Glib::FILE_TEST_EXISTS)) { + if (v != current_version) { + /* older version exists, create the current one */ + ofstream fout (been_here_before_path (current_version).c_str()); + } + return false; + } + } + + return true; } void diff --git a/gtk2_ardour/startup.h b/gtk2_ardour/startup.h index db274ea990..a93a29ef42 100644 --- a/gtk2_ardour/startup.h +++ b/gtk2_ardour/startup.h @@ -60,8 +60,6 @@ class ArdourStartup : public Gtk::Assistant { bool config_modified; bool new_user; - static std::string been_here_before_path (); - void on_apply (); void on_cancel (); bool on_delete_event (GdkEventAny*); diff --git a/libs/ardour/ardour/filesystem_paths.h b/libs/ardour/ardour/filesystem_paths.h index feca4ccb37..afa66453eb 100644 --- a/libs/ardour/ardour/filesystem_paths.h +++ b/libs/ardour/ardour/filesystem_paths.h @@ -45,6 +45,14 @@ namespace ARDOUR { */ LIBARDOUR_API std::string user_cache_directory (); + /** + * @return the path used to store a persistent indication + * that the given version of the program has been used before. + * + * @param version is the version to check for. If unspecified, + * it defaults to the current (build-time) version of the program. + */ + LIBARDOUR_API std::string been_here_before_path (int version = -1); /** * @return the path to the directory that contains the system wide ardour diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc index 9005bd01a3..231bc84a3c 100644 --- a/libs/ardour/filesystem_paths.cc +++ b/libs/ardour/filesystem_paths.cc @@ -272,4 +272,15 @@ ardour_data_search_path () return search_path; } +string +been_here_before_path (int version) +{ + if (version < 0) { + version = atoi (PROGRAM_VERSION); + } + + return Glib::build_filename (user_config_directory (version), string (".a") + to_string (version, std::dec)); +} + + } // namespace ARDOUR |