mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
move "been here before" path concept into libardour, and use it appropriately at startup
This commit is contained in:
parent
ea5e94977b
commit
207ac16731
4 changed files with 35 additions and 8 deletions
|
|
@ -115,13 +115,23 @@ ArdourStartup::~ArdourStartup ()
|
||||||
bool
|
bool
|
||||||
ArdourStartup::required ()
|
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
|
const int current_version = atoi (PROGRAM_VERSION);
|
||||||
ArdourStartup::been_here_before_path ()
|
|
||||||
{
|
for (int v = current_version; v != 0; --v) {
|
||||||
return Glib::build_filename (user_config_directory (), ".a" PROGRAM_VERSION);
|
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
|
void
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,6 @@ class ArdourStartup : public Gtk::Assistant {
|
||||||
bool config_modified;
|
bool config_modified;
|
||||||
bool new_user;
|
bool new_user;
|
||||||
|
|
||||||
static std::string been_here_before_path ();
|
|
||||||
|
|
||||||
void on_apply ();
|
void on_apply ();
|
||||||
void on_cancel ();
|
void on_cancel ();
|
||||||
bool on_delete_event (GdkEventAny*);
|
bool on_delete_event (GdkEventAny*);
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,14 @@ namespace ARDOUR {
|
||||||
*/
|
*/
|
||||||
LIBARDOUR_API std::string user_cache_directory ();
|
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
|
* @return the path to the directory that contains the system wide ardour
|
||||||
|
|
|
||||||
|
|
@ -272,4 +272,15 @@ ardour_data_search_path ()
|
||||||
return 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
|
} // namespace ARDOUR
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue