mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2024-11-23 17:13:11 +03:00
merge config from previous versions
This commit is contained in:
parent
59d48a1070
commit
c1ec746087
@ -23,6 +23,22 @@ pub fn initialize() -> PathBuf {
|
||||
config_path
|
||||
}
|
||||
|
||||
pub fn merge_previous_version() -> Option<PathBuf> {
|
||||
let config_path: PathBuf = Path::new(&get_user_data_dir().unwrap())
|
||||
.join("blue-recorder")
|
||||
.join("config.ini");
|
||||
|
||||
// return none if config.ini not exists
|
||||
if !&config_path.exists() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut config_string: String = String::from_utf8(std::fs::read(&config_path).unwrap()).unwrap();
|
||||
config_string = config_string.replace("Options", "default").replace("True", "1").replace("False", "0");
|
||||
std::fs::write(&config_path, config_string).unwrap();
|
||||
Some(config_path)
|
||||
}
|
||||
|
||||
fn default() {
|
||||
set("default", "frame", "50");
|
||||
set("default", "delay", "0");
|
||||
|
@ -21,6 +21,7 @@ fn main() {
|
||||
}
|
||||
let builder: Builder = Builder::from_file(Path::new("windows/ui.glade"));
|
||||
|
||||
config_management::merge_previous_version();
|
||||
config_management::initialize();
|
||||
|
||||
// get Objects from UI
|
||||
|
Loading…
Reference in New Issue
Block a user