Merge branch 'imbris/small-fixes' into 'master'

Some small fixes

Closes #1155 and #870

See merge request veloren/veloren!2897
This commit is contained in:
Imbris 2021-10-04 16:46:59 +00:00
commit 84e4e17ff5
4 changed files with 27 additions and 7 deletions

3
Cargo.lock generated
View File

@ -5780,7 +5780,7 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f559b464de2e2bdabcac6a210d12e9b5a5973c251e102c44c585c71d51bd78e"
dependencies = [
"cfg-if 1.0.0",
"cfg-if 0.1.10",
"rand 0.8.4",
"static_assertions",
]
@ -6246,7 +6246,6 @@ dependencies = [
"conrod_core",
"conrod_winit",
"copy_dir",
"coreaudio-sys",
"cpal",
"criterion",
"crossbeam-channel",

View File

@ -41,7 +41,15 @@ pub fn userdata_dir(workspace: bool, strategy: Option<&str>, manifest_dir: &str)
path.push("userdata");
Some(path)
},
Some(_) => None, // TODO: panic? catch during compilation?
Some(s) => {
warn!(
"Compiled with an invalid VELOREN_USERDATA_STRATEGY: \"{}\". \
Valid values are unset, \"system\", and \"executable\". \
Falling back to unset case.",
s,
);
None
},
_ => None,
})
// 3. The CARGO_MANIFEST_DIR/userdata or CARGO_MANIFEST_DIR/../userdata depending on if a
@ -61,10 +69,23 @@ pub fn userdata_dir(workspace: bool, strategy: Option<&str>, manifest_dir: &str)
path
} else {
// otherwise warn and fallback to the executable strategy
warn!("This binary was moved to outside the project folder where it was compiled and was not compiled with VELOREN_USERDATA_STRATEGY set to \"system\" or \"executable\". Falling back the to the \"executable\" strategy (the userdata folder will be placed in the same folder as the executable)");
let project_path = path;
let mut path = exe_path;
path.pop();
path.push("userdata");
warn!(
"This binary is outside the project folder where it was compiled ({}) \
and was not compiled with VELOREN_USERDATA_STRATEGY set to \"system\" or \"executable\". \
Falling back the to the \"executable\" strategy (the userdata folder will be placed in the \
same folder as the executable: {}) \n\
NOTE: You can manually select a userdata folder (overriding this automatic selection) by \
setting the environment variable {} to the desired directory before running. \n\
NOTE: If you have not moved the executable this can occur when using a custom cargo \
target-dir that is not inside the project folder.",
project_path.display(),
path.display(),
VELOREN_USERDATA_ENV,
);
path
}
})

View File

@ -126,9 +126,6 @@ profiling = { version = "1.0.1", default-features = false, optional = true }
[target.'cfg(target_os = "macos")'.dependencies]
dispatch = "0.1.4"
# This needs to be backdated for the OSX build, potentially because the SDK is not OSX 11.0 compatible yet.
# This line should be removed when possible because coreaudio-sys is not a direct dep of voxygen.
coreaudio-sys = { version = "=0.2.8", default-features = false }
[target.'cfg(windows)'.build-dependencies]
winres = "0.1"

View File

@ -44,6 +44,9 @@ fn main() {
let log_filename = format!("{}_voxygen.log", now.format("%Y-%m-%d"));
let _guards = common_frontend::init_stdout(Some((&logs_dir, &log_filename)));
// Re-run userdata selection so any warnings will be logged
common_base::userdata_dir_workspace!();
info!("Using userdata dir at: {}", userdata_dir.display());
// Determine Voxygen's config directory either by env var or placed in veloren's