GrafX2 2.9.3227
The ultimate 256-color painting program
|
Functions used to manipulate files path and names. More...
Macros | |
#define | PATH_SEPARATOR "/" |
default path separator character More... | |
Functions | |
char * | Filepath_append_to_dir (const char *dir, const char *filename) |
Construct full file path. More... | |
char * | Extract_filename (const char *source) |
Extracts the filename part from a full file name. More... | |
char * | Extract_path (const char *source) |
Extracts the directory from a full file name. More... | |
char * | Find_last_separator (const char *str) |
Finds the rightmost path separator in a full filename. Used to separate directory from file. More... | |
word * | Find_last_separator_unicode (const word *str) |
Finds the rightmost path separator in a full filename in unicode. Used to separate directory from file. More... | |
int | Position_last_dot (const char *fname) |
finds the rightmost '.' character in fullname. Used to find file extension. returns -1 if not found More... | |
int | Position_last_dot_unicode (const word *fname) |
finds the rightmost '.' character in fullname. Used to find file extension. returns -1 if not found More... | |
word * | Get_Unicode_Filename (word *filename_unicode, const char *filename, const char *directory) |
Convert a file name to unicode characters. More... | |
void | Append_path (char *path, const char *filename, char *reverse_path) |
Appends a file or directory name to an existing directory name. More... | |
Functions used to manipulate files path and names.
#define PATH_SEPARATOR "/" |
default path separator character
char * Filepath_append_to_dir | ( | const char * | dir, |
const char * | filename | ||
) |
Construct full file path.
References GFX2_malloc, NULL, and PATH_SEPARATOR.
Referenced by Button_Autosave(), Button_Quit_local_function(), Button_Skins(), Create_lock_file(), Define_icon(), Emergency_backup(), For_each_directory_entry(), For_each_file(), Get_config_directory(), Get_data_directory(), Init_text(), Load_CFG(), Load_INI(), Load_MOTO(), Load_TIFF(), Load_Unicode_fonts(), Open_file_read(), Open_file_read_with_alternate_ext(), Open_file_write(), Open_file_write_with_alternate_ext(), Release_lock_file(), Remove_file(), Save_CFG(), Save_INI(), Save_picture(), Save_TIFF(), and Test_MOTO().
char * Extract_filename | ( | const char * | source | ) |
Extracts the filename part from a full file name.
References Find_last_separator().
Referenced by Button_Load_or_Save(), Load_ClipBoard_Image(), and Test_File_exists().
char * Extract_path | ( | const char * | source | ) |
Extracts the directory from a full file name.
References Find_last_separator(), GFX2_ERROR, GFX2_Log(), NULL, PATH_SEPARATOR, and Realpath().
Referenced by Get_program_directory(), and Load_ClipBoard_Image().
char * Find_last_separator | ( | const char * | str | ) |
Finds the rightmost path separator in a full filename. Used to separate directory from file.
References NULL, and PATH_SEPARATOR.
Referenced by Analyze_command_line(), Append_path(), Backup_existing_file(), Button_Load_or_Save(), Extract_filename(), Extract_path(), and Main_handler().
Finds the rightmost path separator in a full filename in unicode. Used to separate directory from file.
References NULL, and PATH_SEPARATOR.
Referenced by Main_handler().
int Position_last_dot | ( | const char * | fname | ) |
finds the rightmost '.' character in fullname. Used to find file extension. returns -1 if not found
Referenced by Backup_existing_file(), Button_Load_or_Save(), Format_filename(), and Read_dir_callback().
int Position_last_dot_unicode | ( | const word * | fname | ) |
finds the rightmost '.' character in fullname. Used to find file extension. returns -1 if not found
Referenced by Button_Load_or_Save(), Format_filename_unicode(), and Read_dir_callback().
word * Get_Unicode_Filename | ( | word * | filename_unicode, |
const char * | filename, | ||
const char * | directory | ||
) |
Convert a file name to unicode characters.
If the parametter is null, the buffer is malloc'ed
filename_unicode | the output buffer of MAX_PATH_CHARACTERS wide characters |
filename | the input file name |
directory | the input file directory |
References GFX2_ERROR, GFX2_Log(), GFX2_malloc, MAX_PATH_CHARACTERS, and NULL.
Referenced by Button_Load_or_Save(), and Init_program().
void Append_path | ( | char * | path, |
const char * | filename, | ||
char * | reverse_path | ||
) |
Appends a file or directory name to an existing directory name.
As a special case, when the new item is equal to PARENT_DIR, this will remove the rightmost directory name. reverse_path is optional, if it's non-null, the function will write there :
References Find_last_separator(), PARENT_DIR, and PATH_SEPARATOR.