# return true if a file with this names exists
fun file_exists: Bool do return to_cstring.file_exists
+ # The status of a file. see POSIX stat(2).
fun file_stat: FileStat do return to_cstring.file_stat
+
+ # The status of a file or of a symlink. see POSIX lstat(2).
fun file_lstat: FileStat do return to_cstring.file_lstat
# Remove a file, return true if success
output.close
end
- # remove the trailing extension "ext"
+ # Remove the trailing extension `ext`.
+ #
+ # `ext` usually starts with a dot but could be anything.
+ #
+ # assert "file.txt".strip_extension(".txt") == "file"
+ # assert "file.txt".strip_extension("le.txt") == "fi"
+ # assert "file.txt".strip_extension("xt") == "file.t"
+ #
+ # if `ext` is not present, `self` is returned unmodified.
+ #
+ # assert "file.txt".strip_extension(".tar.gz") == "file.txt"
fun strip_extension(ext: String): String
do
if has_suffix(ext) then