diff --git a/crates/loader/src/local.rs b/crates/loader/src/local.rs index ddea5ab7ab..a92ff47d4b 100644 --- a/crates/loader/src/local.rs +++ b/crates/loader/src/local.rs @@ -30,8 +30,7 @@ impl LocalLoader { files_mount_strategy: FilesMountStrategy, cache_root: Option, ) -> Result { - let app_root = app_root - .canonicalize() + let app_root = safe_canonicalize(app_root) .with_context(|| format!("Invalid manifest dir `{}`", app_root.display()))?; Ok(Self { app_root, @@ -390,6 +389,20 @@ impl LocalLoader { } } +/// This canonicalizes the path in a way that works with globs. On non-Windows +/// platforms, we can use Path::canonicalize, but on Windows platforms this +/// expands to a UNC path, and the glob library does not work with UNC paths. +#[cfg(not(windows))] +fn safe_canonicalize(path: &Path) -> std::io::Result { + path.canonicalize() +} + +#[cfg(windows)] +fn safe_canonicalize(path: &Path) -> std::io::Result { + use path_absolutize::Absolutize; + Ok(path.absolutize()?.into_owned()) +} + fn locked_metadata( details: v2::AppDetails, trigger_types: impl Iterator,