mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'xvar/fix-saves-dir-creation' into 'master'
Fixed initial creation of saves directory See merge request veloren/veloren!2122
This commit is contained in:
commit
6db79d5439
@ -12,6 +12,7 @@ use common::comp;
|
||||
use refinery::Report;
|
||||
use rusqlite::{Connection, OpenFlags};
|
||||
use std::{
|
||||
fs,
|
||||
path::PathBuf,
|
||||
sync::{Arc, RwLock},
|
||||
time::Duration,
|
||||
@ -130,6 +131,10 @@ fn rusqlite_profile_callback(log_message: &str, dur: Duration) {
|
||||
}
|
||||
|
||||
pub(crate) fn establish_connection(settings: &DatabaseSettings) -> VelorenConnection {
|
||||
fs::create_dir_all(&settings.db_dir).expect(&*format!(
|
||||
"Failed to create saves directory: {:?}",
|
||||
&settings.db_dir
|
||||
));
|
||||
let connection = Connection::open_with_flags(
|
||||
&settings.db_dir.join("db.sqlite"),
|
||||
OpenFlags::SQLITE_OPEN_PRIVATE_CACHE | OpenFlags::default(),
|
||||
|
@ -62,8 +62,9 @@ impl Singleplayer {
|
||||
};
|
||||
|
||||
info!(
|
||||
"Saves folder doesn't exist, but there is one in the old saves location, copying \
|
||||
it to the new location"
|
||||
"Saves folder doesn't exist, but there is one in the old saves location ({}), \
|
||||
copying it to the new location",
|
||||
old_path.display()
|
||||
);
|
||||
if let Some(parent) = new_path.parent() {
|
||||
if let Err(e) = std::fs::create_dir_all(parent) {
|
||||
|
Loading…
Reference in New Issue
Block a user