126 * game...keeping external content on a tight leash in this manner can be of |
126 * game...keeping external content on a tight leash in this manner can be of |
127 * utmost importance to some applications. |
127 * utmost importance to some applications. |
128 * |
128 * |
129 * PhysicsFS is mostly thread safe. The error messages returned by |
129 * PhysicsFS is mostly thread safe. The error messages returned by |
130 * PHYSFS_getLastError() are unique by thread, and library-state-setting |
130 * PHYSFS_getLastError() are unique by thread, and library-state-setting |
131 * functions are mutex'd. For efficiency, individual file accesses are |
131 * functions are mutex'd. For efficiency, individual file accesses are |
132 * not locked, so you can not safely read/write/seek/close/etc the same |
132 * not locked, so you can not safely read/write/seek/close/etc the same |
133 * file from two threads at the same time. Other race conditions are bugs |
133 * file from two threads at the same time. Other race conditions are bugs |
134 * that should be reported/patched. |
134 * that should be reported/patched. |
135 * |
135 * |
136 * While you CAN use stdio/syscall file access in a program that has PHYSFS_* |
136 * While you CAN use stdio/syscall file access in a program that has PHYSFS_* |
137 * calls, doing so is not recommended, and you can not use system |
137 * calls, doing so is not recommended, and you can not use system |
138 * filehandles with PhysicsFS and vice versa. |
138 * filehandles with PhysicsFS and vice versa. |
2602 * |
2602 * |
2603 * \sa PHYSFS_stat |
2603 * \sa PHYSFS_stat |
2604 */ |
2604 */ |
2605 typedef enum PHYSFS_FileType |
2605 typedef enum PHYSFS_FileType |
2606 { |
2606 { |
2607 PHYSFS_FILETYPE_REGULAR, /**< a normal file */ |
2607 PHYSFS_FILETYPE_REGULAR, /**< a normal file */ |
2608 PHYSFS_FILETYPE_DIRECTORY, /**< a directory */ |
2608 PHYSFS_FILETYPE_DIRECTORY, /**< a directory */ |
2609 PHYSFS_FILETYPE_SYMLINK, /**< a symlink */ |
2609 PHYSFS_FILETYPE_SYMLINK, /**< a symlink */ |
2610 PHYSFS_FILETYPE_OTHER /**< something completely different like a device */ |
2610 PHYSFS_FILETYPE_OTHER /**< something completely different like a device */ |
2611 } PHYSFS_FileType; |
2611 } PHYSFS_FileType; |
2612 |
2612 |
2613 /** |
2613 /** |
2614 * \struct PHYSFS_Stat |
2614 * \struct PHYSFS_Stat |
2615 * \brief Meta data for a file or directory |
2615 * \brief Meta data for a file or directory |
2626 * \sa PHYSFS_stat |
2626 * \sa PHYSFS_stat |
2627 * \sa PHYSFS_FileType |
2627 * \sa PHYSFS_FileType |
2628 */ |
2628 */ |
2629 typedef struct PHYSFS_Stat |
2629 typedef struct PHYSFS_Stat |
2630 { |
2630 { |
2631 PHYSFS_sint64 filesize; /**< size in bytes, -1 for non-files and unknown */ |
2631 PHYSFS_sint64 filesize; /**< size in bytes, -1 for non-files and unknown */ |
2632 PHYSFS_sint64 modtime; /**< last modification time */ |
2632 PHYSFS_sint64 modtime; /**< last modification time */ |
2633 PHYSFS_sint64 createtime; /**< like modtime, but for file creation time */ |
2633 PHYSFS_sint64 createtime; /**< like modtime, but for file creation time */ |
2634 PHYSFS_sint64 accesstime; /**< like modtime, but for file access time */ |
2634 PHYSFS_sint64 accesstime; /**< like modtime, but for file access time */ |
2635 PHYSFS_FileType filetype; /**< File? Directory? Symlink? */ |
2635 PHYSFS_FileType filetype; /**< File? Directory? Symlink? */ |
2636 int readonly; /**< non-zero if read only, zero if writable. */ |
2636 int readonly; /**< non-zero if read only, zero if writable. */ |
2637 } PHYSFS_Stat; |
2637 } PHYSFS_Stat; |
2638 |
2638 |
2639 /** |
2639 /** |
2640 * \fn int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat) |
2640 * \fn int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat) |
2641 * \brief Get various information about a directory or a file. |
2641 * \brief Get various information about a directory or a file. |