fix(ci): resolve a bare drive WORKDIR to the drive root (#3258)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-07 21:44:18 +02:00
1 parent 002502a7fa
commit 317fedeef9
1 file changed
+20 -1
+20 -1
View File
@@ -495,10 +495,18 @@ fn workspace_dir() -> PathBuf {
fn workdir() -> PathBuf {
env::var("WORKDIR")
.map(PathBuf::from)
.map(|value| workdir_path(&value))
.unwrap_or_else(|_| workspace_dir())
}
fn workdir_path(value: &str) -> PathBuf {
let bytes = value.as_bytes();
if bytes.len() == 2 && bytes[0].is_ascii_alphabetic() && bytes[1] == b':' {
return PathBuf::from(format!("{value}\\"));
}
PathBuf::from(value)
}
fn desktop_dist_dir() -> PathBuf {
workdir().join("fluxer_desktop").join("dist-electron")
}
@@ -5584,6 +5592,17 @@ mod tests {
.unwrap()
}
#[test]
fn bare_drive_workdir_resolves_to_the_drive_root() {
assert_eq!(workdir_path("W:"), PathBuf::from("W:\\"));
assert_eq!(workdir_path("w:"), PathBuf::from("w:\\"));
assert_eq!(workdir_path("W:\\src"), PathBuf::from("W:\\src"));
assert_eq!(
workdir_path("/home/runner/work"),
PathBuf::from("/home/runner/work")
);
}
fn matrix_args() -> BuildDesktopArgs {
BuildDesktopArgs {
step: DesktopStep::SetMatrix,