Code archives/File Utilities/Filecheck
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
Use this code to check all files of your game. If any file doesn't exist, you can abort the programm or notify about the missing file. Enter this code at the beginning of your application. | |||||
;Number of files to check for program files_count = 4 Dim files$(files_count) ;Filenames files$(1) = "FILE_01.DAT" files$(2) = "FILE_02.DAT" files$(3) = "FILE_03.DAT" files$(4) = "FILE_04.DAT" ;Check files For d = 1 To files_count checkfile = FileType(files$(d)) If checkfile <> 1 RuntimeError "File " + Chr$(34) + files$(d)+Chr$(34) + " doesn't exist!" ;If checkfile <> 1 Notify "File " + Chr$(34) + files$(d)+Chr$(34) + " doesn't exist!" CloseFile checkfile Next |
Comments
| ||
An easier way to go would be to wrap your "file open" and "load" commands in your own function that checks the return value and aborts if the file isn't there. Constantly updating a list like this at the start of your game is just asking for trouble. The odds of forgetting to add one are astronomical. |
Code Archives Forum