diff --git a/src/playdate/file.nim b/src/playdate/file.nim index f842713..5c075a8 100644 --- a/src/playdate/file.nim +++ b/src/playdate/file.nim @@ -42,6 +42,12 @@ proc stat*(this: ptr PlaydateFile, path: string): FileStat {.raises: [IOError]} raise newException(IOError, $playdate.file.geterr()) return info +proc exists*(this: ptr PlaydateFile, path: string): bool = + privateAccess(PlaydateFile) + var info: FileStat = FileStat() + let res = this.stat(path.cstring, addr(info[])) + return res != 0 + proc unlink*(this: ptr PlaydateFile, path: string, recursive: bool) {.raises: [IOError]} = privateAccess(PlaydateFile) let res = this.unlink(path.cstring, if recursive: 1 else: 0)