Skip to content

Commit

Permalink
return a byond falsey value if no file is found
Browse files Browse the repository at this point in the history
  • Loading branch information
Kapu1178 committed Dec 20, 2023
1 parent 75a6384 commit 1ac69fd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ fn read(path: &str) -> Result<String> {

fn exists(path: &str) -> String {
let path = std::path::Path::new(path);
path.exists().to_string()
// This is for parity with the truthy-ness of byond's fexists()
if path.exists(){
String::from("true")
}
else {
String::new()
}
}

fn write(data: &str, path: &str) -> Result<usize> {
Expand Down

0 comments on commit 1ac69fd

Please sign in to comment.