Make singleplayer use voxygen's config path for persistence path.

This commit is contained in:
Mckol 2020-05-14 01:37:53 +02:00
parent aa69046055
commit 48c5d37a5d
2 changed files with 10 additions and 2 deletions

View File

@ -97,7 +97,7 @@ impl ServerSettings {
Ok(())
}
pub fn singleplayer() -> Self {
pub fn singleplayer(persistence_db_dir: String) -> Self {
let load = Self::load();
Self {
//BUG: theoretically another process can grab the port between here and server
@ -123,6 +123,7 @@ impl ServerSettings {
start_time: 9.0 * 3600.0,
admins: vec!["singleplayer".to_string()], /* TODO: Let the player choose if they want
* to use admin commands or not */
persistence_db_dir,
..load // Fill in remaining fields from server_settings.ron.
}
}

View File

@ -32,7 +32,14 @@ impl Singleplayer {
let (sender, receiver) = unbounded();
// Create server
let settings = ServerSettings::singleplayer();
let settings = ServerSettings::singleplayer(
crate::settings::Settings::get_settings_path()
.parent()
.unwrap()
.join("saves")
.to_string_lossy()
.to_string(),
);
let thread_pool = client.map(|c| c.thread_pool().clone());
let settings2 = settings.clone();