mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 06:35:46 +01:00
more infrastructure for copying old configuration files
This commit is contained in:
parent
59880b7fa3
commit
8587855b99
2 changed files with 75 additions and 6 deletions
|
|
@ -51,7 +51,7 @@ namespace ARDOUR {
|
|||
extern LIBARDOUR_API PBD::Signal3<void,std::string,std::string,bool> PluginScanMessage;
|
||||
extern LIBARDOUR_API PBD::Signal1<void,int> PluginScanTimeout;
|
||||
extern LIBARDOUR_API PBD::Signal0<void> GUIIdle;
|
||||
extern LIBARDOUR_API PBD::Signal2<void,std::string,std::string> CopyConfigurationFiles;
|
||||
extern LIBARDOUR_API PBD::Signal3<void,std::string,std::string,int> CopyConfigurationFiles;
|
||||
|
||||
/**
|
||||
* @param with_vst true to enable VST Support
|
||||
|
|
@ -82,6 +82,8 @@ namespace ARDOUR {
|
|||
|
||||
LIBARDOUR_API void setup_fpu ();
|
||||
LIBARDOUR_API std::vector<SyncSource> get_available_sync_options();
|
||||
|
||||
LIBARDOUR_API int copy_configuration_files (std::string const & old_dir, std::string const & new_dir, int old_version);
|
||||
}
|
||||
|
||||
#endif /* __ardour_ardour_h__ */
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@
|
|||
#include "ardour/audioregion.h"
|
||||
#include "ardour/buffer_manager.h"
|
||||
#include "ardour/control_protocol_manager.h"
|
||||
#include "ardour/directory_names.h"
|
||||
#include "ardour/event_type_map.h"
|
||||
#include "ardour/filesystem_paths.h"
|
||||
#include "ardour/midi_region.h"
|
||||
|
|
@ -131,7 +132,7 @@ PBD::Signal1<void,std::string> ARDOUR::BootMessage;
|
|||
PBD::Signal3<void,std::string,std::string,bool> ARDOUR::PluginScanMessage;
|
||||
PBD::Signal1<void,int> ARDOUR::PluginScanTimeout;
|
||||
PBD::Signal0<void> ARDOUR::GUIIdle;
|
||||
PBD::Signal2<void,std::string,std::string> ARDOUR::CopyConfigurationFiles;
|
||||
PBD::Signal3<void,std::string,std::string,int> ARDOUR::CopyConfigurationFiles;
|
||||
|
||||
namespace ARDOUR {
|
||||
extern void setup_enum_writer ();
|
||||
|
|
@ -239,6 +240,70 @@ lotsa_files_please ()
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::copy_configuration_files (string const & old_dir, string const & new_dir, int old_version)
|
||||
{
|
||||
string old_name;
|
||||
string new_name;
|
||||
|
||||
if (old_version == 3) {
|
||||
|
||||
old_name = Glib::build_filename (old_dir, "recent");
|
||||
new_name = Glib::build_filename (new_dir, "recent");
|
||||
|
||||
copy_file (old_name, new_name);
|
||||
|
||||
/* can only copy ardour.rc - UI config is not compatible */
|
||||
|
||||
old_name = Glib::build_filename (old_dir, "ardour.rc");
|
||||
new_name = Glib::build_filename (new_dir, "config");
|
||||
|
||||
copy_file (old_name, new_name);
|
||||
|
||||
/* copy templates and route templates */
|
||||
|
||||
old_name = Glib::build_filename (old_dir, "templates");
|
||||
new_name = Glib::build_filename (new_dir, "templates");
|
||||
|
||||
copy_files (old_name, new_name);
|
||||
|
||||
old_name = Glib::build_filename (old_dir, "route_templates");
|
||||
new_name = Glib::build_filename (new_dir, "route_templates");
|
||||
|
||||
copy_files (old_name, new_name);
|
||||
|
||||
/* presets */
|
||||
|
||||
old_name = Glib::build_filename (old_dir, "presets");
|
||||
new_name = Glib::build_filename (new_dir, "presets");
|
||||
|
||||
copy_files (old_name, new_name);
|
||||
|
||||
/* presets */
|
||||
|
||||
old_name = Glib::build_filename (old_dir, "plugin_statuses");
|
||||
new_name = Glib::build_filename (new_dir, "plugin_statuses");
|
||||
|
||||
copy_file (old_name, new_name);
|
||||
|
||||
/* export formats */
|
||||
|
||||
old_name = Glib::build_filename (old_dir, export_formats_dir_name);
|
||||
new_name = Glib::build_filename (new_dir, export_formats_dir_name);
|
||||
|
||||
vector<string> export_formats;
|
||||
g_mkdir_with_parents (Glib::build_filename (new_dir, export_formats_dir_name).c_str(), 0755);
|
||||
find_files_matching_pattern (export_formats, old_name, "*.format");
|
||||
for (vector<string>::iterator i = export_formats.begin(); i != export_formats.end(); ++i) {
|
||||
std::string from = *i;
|
||||
std::string to = Glib::build_filename (new_name, Glib::path_get_basename (*i));
|
||||
copy_file (from, to);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_copy_old_configuration_files ()
|
||||
{
|
||||
|
|
@ -248,11 +313,13 @@ maybe_copy_old_configuration_files ()
|
|||
return;
|
||||
}
|
||||
|
||||
string old_config_dir = user_config_directory (version-1);
|
||||
string current_config_dir = user_config_directory ();
|
||||
|
||||
version--;
|
||||
|
||||
string old_config_dir = user_config_directory (version);
|
||||
|
||||
if (Glib::file_test (old_config_dir, Glib::FILE_TEST_IS_DIR)) {
|
||||
CopyConfigurationFiles (old_config_dir, current_config_dir); /* EMIT SIGNAL */
|
||||
string current_config_dir = user_config_directory ();
|
||||
CopyConfigurationFiles (old_config_dir, current_config_dir, version); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue