Skip to content

Commit

Permalink
Add file_exist function to std
Browse files Browse the repository at this point in the history
  • Loading branch information
clysto committed May 26, 2024
1 parent cd832b1 commit 92e8553
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/std/main.ab
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ pub fun replace_regex(source: Text, pattern: Text, replacement: Text): Text {
return unsafe $echo "{source}" | sed -e "s/{pattern}/{replacement}/g"$
}

pub fun file_exist(file) {
$[ -f "{file}" ]$ failed {
return false
}
return true
}

pub fun file_read(path) {
return $cat "{path}"$?
}
Expand Down

0 comments on commit 92e8553

Please sign in to comment.