Skip to content

Commit

Permalink
fixed crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimaoth committed Mar 23, 2024
1 parent 17565c4 commit f3923da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/platform/filesystem_desktop.nim
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ method getApplicationFilePath*(self: FileSystemDesktop, name: string): string =
method loadApplicationFile*(self: FileSystemDesktop, name: string): string =
let path = self.getApplicationFilePath name
log lvlInfo, fmt"loadApplicationFile {name} -> {path}"
return readFile(path)
try:
return readFile(path)
except:
log lvlError, fmt"Failed to load application file {path}: {getCurrentExceptionMsg()}"
return ""

method saveApplicationFile*(self: FileSystemDesktop, name: string, content: string) =
let path = self.getApplicationFilePath name
log lvlInfo, fmt"saveApplicationFile {name} -> {path}"
writeFile(path, content)
try:
writeFile(path, content)
except:
log lvlError, fmt"Failed to save application file {path}: {getCurrentExceptionMsg()}"

0 comments on commit f3923da

Please sign in to comment.