GrafX2 2.9.3227
The ultimate 256-color painting program
|
filesystem operations More...
Typedefs | |
typedef void | T_File_dir_cb(void *pdata, const char *filename, const word *unicode_filename, byte is_file, byte is_directory, byte is_hidden) |
Functions | |
unsigned long | File_length (const char *fname) |
Size of a file, in bytes. Returns 0 in case of error. More... | |
int | File_exists (const char *fname) |
Returns true if a file passed as a parameter exists in the current directory. More... | |
int | Directory_exists (const char *directory) |
Returns true if a directory passed as a parameter exists in the current directory. More... | |
int | Directory_create (const char *directory) |
Creates a directory. More... | |
int | File_is_hidden (const char *fname, const char *full_name) |
Check if a file or directory is hidden. Full name (with directories) is optional. More... | |
void | For_each_file (const char *directory_name, void Callback(const char *full_name, const char *file_name)) |
Scans a directory, calls Callback for each file in it,. More... | |
void | For_each_directory_entry (const char *directory_name, void *pdata, T_File_dir_cb Callback) |
Scans a directory, calls Callback for each file or directory in it,. More... | |
byte | Create_lock_file (const char *file_directory) |
Creates a lock file, to check if an other instance of Grafx2 is running. More... | |
void | Release_lock_file (const char *file_directory) |
Release a lock file created by Create_lock_file. More... | |
char * | Get_current_directory (char *buf, word **unicode, size_t size) |
Return the current directory, equivalent to getcwd() More... | |
int | Change_directory (const char *path) |
Change current directory. return 0 for success, -1 in case of error. More... | |
int | Remove_path (const char *path) |
Remove the file. More... | |
int | Remove_directory (const char *path) |
Remove the directory. More... | |
char * | Calculate_relative_path (const char *ref_path, const char *path) |
Calculate relative path. More... | |
filesystem operations
typedef void T_File_dir_cb(void *pdata, const char *filename, const word *unicode_filename, byte is_file, byte is_directory, byte is_hidden) |
unsigned long File_length | ( | const char * | fname | ) |
Size of a file, in bytes. Returns 0 in case of error.
Referenced by Load_TIFF(), and Test_Read_Write_bytes().
int File_exists | ( | const char * | fname | ) |
Returns true if a file passed as a parameter exists in the current directory.
Referenced by Analyze_command_line(), Backup_existing_file(), Button_Autosave(), Button_Load_or_Save(), Button_Quit_local_function(), Get_config_directory(), Load_ClipBoard_Image(), Save_INI(), Save_picture(), Test_File_exists(), and Test_MOTO().
int Directory_exists | ( | const char * | directory | ) |
Returns true if a directory passed as a parameter exists in the current directory.
References NULL, and PARENT_DIR.
Referenced by Button_Load_or_Save(), Get_config_directory(), and Test_File_exists().
int Directory_create | ( | const char * | directory | ) |
Creates a directory.
References NULL.
Referenced by Get_config_directory().
int File_is_hidden | ( | const char * | fname, |
const char * | full_name | ||
) |
Check if a file or directory is hidden. Full name (with directories) is optional.
Check if a file or directory is hidden. Full name (with directories) is optional.
References NULL, and PARENT_DIR.
Referenced by For_each_directory_entry().
void For_each_file | ( | const char * | directory_name, |
void | Callbackconst char *full_name, const char *file_name | ||
) |
Scans a directory, calls Callback for each file in it,.
void For_each_directory_entry | ( | const char * | directory_name, |
void * | pdata, | ||
T_File_dir_cb | Callback | ||
) |
Scans a directory, calls Callback for each file or directory in it,.
References File_is_hidden(), Filepath_append_to_dir(), GFX2_ERROR, GFX2_Log(), GFX2_malloc, GFX2_WARNING, NULL, Unicode_char_strlcat(), and Unicode_char_strlcpy().
Referenced by Open_file_read_with_alternate_ext(), Read_list_of_files(), and Test_File_exists().
byte Create_lock_file | ( | const char * | file_directory | ) |
Creates a lock file, to check if an other instance of Grafx2 is running.
References Filepath_append_to_dir(), GFX2_LOCK_FILENAME, Lock_file_handle, and NULL.
Referenced by Check_recovery().
void Release_lock_file | ( | const char * | file_directory | ) |
Release a lock file created by Create_lock_file.
References Filepath_append_to_dir(), GFX2_LOCK_FILENAME, Lock_file_handle, and Remove_path().
Referenced by Delete_safety_backups().
char * Get_current_directory | ( | char * | buf, |
word ** | unicode, | ||
size_t | size | ||
) |
Return the current directory, equivalent to getcwd()
buf | destination buffer. can be NULL |
unicode | destination pointer for the unicode version of the path |
size | destination buffer size, ignored if buf is NULL |
References GFX2_ERROR, GFX2_Log(), GFX2_malloc, MAX_PATH_CHARACTERS, NULL, and PATH_SEPARATOR.
Referenced by Button_Load_or_Save(), Get_program_directory(), Init_program(), and Read_list_of_files().
int Change_directory | ( | const char * | path | ) |
Change current directory. return 0 for success, -1 in case of error.
References GFX2_DEBUG, and GFX2_Log().
Referenced by Button_Load_or_Save(), Delete_safety_backups(), and Program_shutdown().
int Remove_path | ( | const char * | path | ) |
Remove the file.
Referenced by Backup_existing_file(), Button_Load_or_Save(), Release_lock_file(), Remove_file(), Rotate_safety_backups(), Test_File_exists(), Test_Read_Write_byte(), Test_Read_Write_bytes(), Test_Read_Write_dword(), Test_Read_Write_word(), and Test_Realpath().
int Remove_directory | ( | const char * | path | ) |
Remove the directory.
Referenced by Button_Load_or_Save().
char * Calculate_relative_path | ( | const char * | ref_path, |
const char * | path | ||
) |
Calculate relative path.
References GFX2_malloc, NULL, PATH_SEPARATOR, and Realpath().
Referenced by Button_Load_or_Save(), and Test_Calculate_relative_path().