diff --git a/common/base/src/userdata_dir.rs b/common/base/src/userdata_dir.rs index e1fe66c479..5de4e728a8 100644 --- a/common/base/src/userdata_dir.rs +++ b/common/base/src/userdata_dir.rs @@ -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 } }) diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index cd6b98eab0..03636809f1 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -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