Skip to content

Commit

Permalink
Update lib/util/fs.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Kenneth Loeffler <[email protected]>
  • Loading branch information
filiptibell and kennethloeffler authored Apr 24, 2024
1 parent c8cc7d2 commit ff222cf
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/util/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ pub async fn write_executable_file(
) -> RokitResult<()> {
let path = path.as_ref();

if !EXE_EXTENSION.is_empty() && !path.ends_with(EXE_EXTENSION) {
warn!(
"An executable file was written without an executable extension!\
if !EXE_EXTENSION.is_empty() {
match path.extension() {
Some(extension) if extension == EXE_EXTENSION => {}
_ => warn!(
"An executable file was written without an executable extension!\
\nThe file at '{path:?}' may not be usable.\
\nThis is most likely a bug in Rokit, please report it at {}",
env!("CARGO_PKG_REPOSITORY").trim_end_matches(".git")
);
env!("CARGO_PKG_REPOSITORY").trim_end_matches(".git")
),
}
}

if let Err(e) = write(path, contents).await {
error!("Failed to write executable to {path:?}:\n{e}");
return Err(e.into());
Expand Down

0 comments on commit ff222cf

Please sign in to comment.