Blitz3D+ Command Reference

FilesystemErrorPath$ ( )

Parameters

None.

Description

Returns the path involved in the last recoverable filesystem failure.

"Could not save" is a frustrating dialog; "Could not save saves\slot1\game.json" is an actionable one. FilesystemErrorPath remembers the caller-supplied UTF-8 path the failed operation was working on, so error dialogs and logs can name the exact file - which matters once your save system touches several files (slots, profiles, backups, screenshots) and a bare message would leave you guessing which one failed.

It completes the trio with FilesystemError (the message) and FilesystemErrorCode (the number): all three are set together whenever a command in this family fails - LoadJson, SaveJsonAtomic, WriteTextAtomic, WriteBankAtomic, CreateDirTree, Sha256File and Sha256FileBytes - and cleared by the next successful operation, so read them straight after the failed call. Context-local like its companions.

For the full rules, see the Application Data language reference.

Requires Extended mode.

See also: FilesystemError, FilesystemErrorCode, SaveJsonAtomic, Sha256File.

Example

; FilesystemErrorPath Example
; ---------------------------
; Requires Extended mode.

; Try to hash a save file that does not exist - a recoverable
; failure that returns empty and sets the filesystem diagnostics
digest$=Sha256File("missing_save_example.json")
Print "Sha256File returned '"+digest+"' (empty = failed)"
Print ""

; FilesystemErrorPath returns the full path of the file the
; failed operation was working on - so an error dialog can name
; exactly which save file could not be read
Print "FilesystemErrorPath:"
Print "  "+FilesystemErrorPath()
Print ""

; Its companions describe the failure and give the raw code
Print "FilesystemError: "+FilesystemError()
Print "FilesystemErrorCode: "+FilesystemErrorCode()

Print ""
Print "Press any key to close the example"
WaitKey

End

Index