Skip to content

Commit

Permalink
Always use / as path separators in generated artifacts
Browse files Browse the repository at this point in the history
Reviewed By: tyao1

Differential Revision: D50243120

fbshipit-source-id: ff770f176eb4ffc6b818867d787ca9fc07d325ac
  • Loading branch information
captbaritone authored and facebook-github-bot committed Oct 12, 2023
1 parent 1d95ce2 commit 2699206
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions compiler/crates/relay-config/src/project_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use std::fmt;
use std::path::Path;
use std::path::PathBuf;
use std::path::MAIN_SEPARATOR;
use std::str::FromStr;
use std::sync::Arc;
use std::usize;
Expand Down Expand Up @@ -418,10 +419,7 @@ impl ProjectConfig {
)
});

resolver_module_location
.join(module_file_name)
.to_string_lossy()
.intern()
format_normalized_path(&resolver_module_location.join(module_file_name)).intern()
}
JsModuleFormat::Haste => Path::new(&target_module.to_string())
.file_stem()
Expand All @@ -431,3 +429,10 @@ impl ProjectConfig {
}
}
}

// Stringify a path such that it is stable across operating systems.
fn format_normalized_path(path: &Path) -> String {
path.to_string_lossy()
.to_string()
.replace(MAIN_SEPARATOR, "/")
}

0 comments on commit 2699206

Please sign in to comment.