|
File system
These functions allow access to the filesystem. This can either be the real filesystem like your harddrive, or a virtual filesystem like a .zip archive (or whatever else you or an addon makes it do). ALLEGRO_FS_ENTRY
Opaque filesystem entry object. Represents a file or a directory (check with al_fs_entry_is_directory or al_fs_entry_is_file). There are no user accessible member variables. ALLEGRO_FILE_MODE
Filesystem modes/types
al_create_fs_entry
Creates an ALLEGRO_FS_ENTRY object pointing to path on the filesystem. 'path' can be a file or a directory and must not be NULL. al_destroy_fs_entry
Destroys a fs entry handle. The file or directory represented by it is not destroyed. Does nothing if passed NULL. al_get_fs_entry_name
Returns the entry's filename path. Note that the path will not be an absolute path if the entry wasn't created from an absolute path. Also not that the filesystem encoding may not be known and the conversion to UTF-8 could in very rare cases cause this to return an invalid path. Therefore it's always safest to access the file over its ALLEGRO_FS_ENTRY and not the path. On success returns a read only path structure, which you must not modify or destroy. Returns NULL on failure; errno is set to indicate the error. al_update_fs_entry
Updates file status information for a filesystem entry. File status information is automatically updated when the entry is created, however you may update it again with this function, e.g. in case it changed. Returns true on success, false on failure. Fills in errno to indicate the error. See also: al_get_errno, al_get_fs_entry_atime, al_get_fs_entry_ctime, al_fs_entry_is_directory, al_fs_entry_is_file, al_get_fs_entry_mode al_get_fs_entry_mode
Returns the entry's mode flags, i.e. permissions and whether the entry refers to a file or directory. See also: al_get_errno, ALLEGRO_FILE_MODE al_get_fs_entry_atime
Returns the time in seonds since the epoch since the entry was last accessed. Warning: some filesystem either don't support this flag, or people turn it off to increase performance. It may not be valid in all circumstances. See also: al_get_fs_entry_ctime, al_get_fs_entry_mtime, al_update_fs_entry al_get_fs_entry_ctime
Returns the time in seconds since the epoch this entry was created on the filsystem. See also: al_get_fs_entry_atime, al_get_fs_entry_mtime, al_update_fs_entry al_get_fs_entry_mtime
Returns the time in seconds since the epoch since the entry was last modified. See also: al_get_fs_entry_atime, al_get_fs_entry_ctime, al_update_fs_entry al_get_fs_entry_size
Returns the size, in bytes, of the given entry. May not return anything sensible for a directory entry. See also: al_update_fs_entry al_fs_entry_exists
Check if the given entry exists on in the filesystem. Returns true if it does exist or false if it doesn't exist, or an error occured. Error is indicated in Allegro' errno. al_fs_entry_is_file
Return true iff this entry is a regular file. See also: al_get_fs_entry_mode al_fs_entry_is_directory
Return true iff this entry is a directory. See also: al_get_fs_entry_mode al_remove_fs_entry
Delete this filesystem entry from the filesystem. Only files and empty directories may be deleted. Returns true on success, and false on failure, error is indicated in Allegro' errno. See also: al_filename_exists al_filename_exists
Check if the path exists on the filesystem, without creating an ALLEGRO_FS_ENTRY object explicitly. See also: al_fs_entry_exists al_remove_filename
Delete the given path from the filesystem, which may be a file or an empty directory. This is the same as al_remove_fs_entry, except it expects the path as a string. Returns true on success, and false on failure. Allegro's errno is filled in to indicate the error. See also: al_remove_fs_entry Directory functionsal_open_directory
Opens a directory entry object. You must call this before using al_read_directory on an entry and you must call al_close_directory when you no longer need it. Returns true on success. See also: al_read_directory, al_close_directory al_read_directory
Reads the next directory item and returns a filesystem entry for it. Returns NULL if there are no more entries or if an error occurs. Call al_close_directory on the directory handle when you are done. See also: al_open_directory, al_close_directory al_close_directory
Closes a previously opened directory entry object. Returns true on success, false on failure and fills in Allegro's errno to indicate the error. See also: al_open_directory, al_read_directory al_get_current_directory
Returns the path to the current working directory, or NULL on failure. Allegro's errno is filled in to indicate the error. See also: al_get_errno al_change_directory
Changes the current working directory to 'path'. Returns true on success, false on error. al_make_directory
Creates a new directory on the filesystem. Returns true on success, false on error. Fills in Allegro's errno to indicate the error. See also: al_get_errno Alternative filesystem functionsBy default, Allegro uses platform specific filesystem functions for things like directory access. However if for example the files of your game are not in the local filesystem but inside some file archive, you can provide your own set of functions (or use an addon which does this for you, for example our physfs addon allows access to the most common archive formats). ALLEGRO_FS_INTERFACE
The available functions you can provide for a filesystem. They are:
al_set_fs_interface
Set the ALLEGRO_FS_INTERFACE table for the calling thread. See also: al_set_standard_fs_interface, al_store_state, al_restore_state. al_set_standard_fs_interface
Return the ALLEGRO_FS_INTERFACE table to the default, for the calling thread. See also: al_set_fs_interface. al_get_fs_interface
Return a pointer to the ALLEGRO_FS_INTERFACE table in effect for the calling thread. See also: al_store_state, al_restore_state. |
Last updated: 2009-09-13 09:23:22 UTC