fix not waiting for folder creation
This commit is contained in:
parent
f4cc2f492c
commit
749e38d5e5
|
@ -10,7 +10,7 @@ pub fn init() {
|
||||||
let mut appdata = PathBuf::from(&binding);
|
let mut appdata = PathBuf::from(&binding);
|
||||||
|
|
||||||
appdata = appdata.join("learn-hieroglyph");
|
appdata = appdata.join("learn-hieroglyph");
|
||||||
Command::new("mkdir").arg(&appdata);
|
Command::new("mkdir").arg(&appdata).spawn().expect(&format!("Cannot create program's home: {}", &appdata.to_str().unwrap())).wait().unwrap();
|
||||||
|
|
||||||
appdata
|
appdata
|
||||||
} else {
|
} else {
|
||||||
|
@ -18,16 +18,17 @@ pub fn init() {
|
||||||
let mut home = PathBuf::from(&binding);
|
let mut home = PathBuf::from(&binding);
|
||||||
|
|
||||||
home = home.join(".config/learn-hieroglyph");
|
home = home.join(".config/learn-hieroglyph");
|
||||||
Command::new("mkdir").args(["-p", &home.to_str().unwrap()]).spawn().expect(&format!("Cannot create program's home: {}", &home.to_str().unwrap()));
|
Command::new("mkdir").args(["-p", &home.to_str().unwrap()]).spawn().expect(&format!("Cannot create program's home: {}", &home.to_str().unwrap())).wait().unwrap();
|
||||||
|
|
||||||
home
|
home
|
||||||
};
|
};
|
||||||
let mut p = PROGRAM_HOME_PATH.write().unwrap();
|
let mut p = PROGRAM_HOME_PATH.write().unwrap();
|
||||||
*p = program_home_path.as_path().to_str().unwrap().to_string();
|
*p = program_home_path.as_path().to_str().unwrap().to_string();
|
||||||
|
|
||||||
println!("Program's home: {}", program_home_path.as_path().to_str().unwrap());
|
let db_path = program_home_path.join("db.sqlite");
|
||||||
|
|
||||||
let connection = Connection::open(program_home_path.join("db.sqlite")).unwrap();
|
|
||||||
|
let connection = Connection::open(db_path).unwrap();
|
||||||
|
|
||||||
connection.execute("CREATE TABLE IF NOT EXISTS cards (
|
connection.execute("CREATE TABLE IF NOT EXISTS cards (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
|
Loading…
Reference in New Issue