make filenames cross-platform

This commit is contained in:
Folkert 2022-08-30 14:16:20 +02:00
parent 42ef5d1977
commit e8f6f69bff
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -482,15 +482,29 @@ pub fn rebuild_host(
host_input_path.with_file_name("host.bc")
}
} else {
host_input_path.with_file_name(if shared_lib_path.is_some() {
"dynhost"
let os = roc_target::OperatingSystem::from(target.operating_system);
if shared_lib_path.is_some() {
let extension = match os {
roc_target::OperatingSystem::Windows => "exe",
roc_target::OperatingSystem::Unix => "",
roc_target::OperatingSystem::Wasi => "",
};
host_input_path
.with_file_name("dynhost")
.with_extension(extension)
} else {
match roc_target::OperatingSystem::from(target.operating_system) {
roc_target::OperatingSystem::Windows => "host.obj",
roc_target::OperatingSystem::Unix => "host.o",
roc_target::OperatingSystem::Wasi => "host.o",
}
})
let extension = match os {
roc_target::OperatingSystem::Windows => "obj",
roc_target::OperatingSystem::Unix => "o",
roc_target::OperatingSystem::Wasi => "o",
};
host_input_path
.with_file_name("host")
.with_extension(extension)
}
};
let env_path = env::var("PATH").unwrap_or_else(|_| "".to_string());