Skip to content

Commit

Permalink
Merge pull request #2161 from itowlson/fix-windows-asset-globs
Browse files Browse the repository at this point in the history
Fix Windows not copying globs or directories
  • Loading branch information
itowlson authored Dec 13, 2023
2 parents 7e746aa + 9ad44b9 commit de76f07
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions crates/loader/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ impl LocalLoader {
files_mount_strategy: FilesMountStrategy,
cache_root: Option<PathBuf>,
) -> Result<Self> {
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,
Expand Down Expand Up @@ -401,6 +400,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<PathBuf> {
path.canonicalize()
}

#[cfg(windows)]
fn safe_canonicalize(path: &Path) -> std::io::Result<PathBuf> {
use path_absolutize::Absolutize;
Ok(path.absolutize()?.into_owned())
}

fn locked_metadata(
details: v2::AppDetails,
trigger_types: impl Iterator<Item = String>,
Expand Down

0 comments on commit de76f07

Please sign in to comment.