Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

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

Hampus317fedeef9ae
diff --git a/tools/ci/src/desktop.rs b/tools/ci/src/desktop.rs
index 5fbee5bfe..7f35f599b 100644
--- a/tools/ci/src/desktop.rs
+++ b/tools/ci/src/desktop.rs
@@ -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,