File and directory manupulation
[File/Path Manupulation API]
File and directory manupulation routines provide a unified API to manupulate a file system, encapsulating the difference between Win32 and POSIX APIs.
More...Typedefs | |
typedef int(*) | filepath_findfile_callback (void *instance, const ucs2char_t *found_path, const ucs2char_t *found_file) |
Prototype for the callback function for receiving found files. | |
Functions | |
FILEPATHAPI int | find_file (const ucs2char_t *path, int recursive, filepath_findfile_callback callback, void *instance) |
Find files. | |
FILEPATHAPI int | filepath_file_exists (const ucs2char_t *path) |
Test the existence of a file. | |
FILEPATHAPI int | filepath_hasext (const ucs2char_t *filename, const ucs2char_t *ext) |
Test a file name has an extension. | |
FILEPATHAPI int | filepath_is_dir (const ucs2char_t *path) |
Test if a filepath name represents a directory. | |
FILEPATHAPI int | filepath_is_relative (const ucs2char_t *path) |
Test if a filepath name represents a relative path. | |
FILEPATHAPI int | filepath_is_same_root (const ucs2char_t *path1, const ucs2char_t *path2) |
Test if two path names has a common prefix of a directory. | |
FILEPATHAPI time_t | filepath_mtime (const ucs2char_t *filename) |
Obtain the last-modified time of a file. | |
FILEPATHAPI int | filepath_compare_lastupdate (const ucs2char_t *file1, const ucs2char_t *file2) |
Compares the modification times of two files. | |
FILEPATHAPI uint32_t | filepath_size (const ucs2char_t *filename) |
Obtain the size of a file. | |
FILEPATHAPI int | filepath_removefile (const ucs2char_t *file) |
Remove a file. | |
FILEPATHAPI int | filepath_copyfile (const ucs2char_t *src, const ucs2char_t *dst) |
Copy a file. |
Detailed Description
File and directory manupulation routines provide a unified API to manupulate a file system, encapsulating the difference between Win32 and POSIX APIs.
Typedef Documentation
typedef int(*) filepath_findfile_callback(void *instance, const ucs2char_t *found_path, const ucs2char_t *found_file) |
Prototype for the callback function for receiving found files.
- Parameters:
-
instance The instance value. found_path The path-name portion of the found file. found_file The file-name portion of the found file.
- Return values:
-
int Reserved.
Definition at line 238 of file filepath.h.
Function Documentation
FILEPATHAPI int filepath_compare_lastupdate | ( | const ucs2char_t * | file1, | |
const ucs2char_t * | file2 | |||
) |
Compares the modification times of two files.
This function compares the modification times of file1
and file2
and returns the difference between them is returned.
- Parameters:
-
file1 The name of file #1. file2 The name of file #2.
- Return values:
-
int The comparison result: - < 0, if file2 was modified more recently than file1;
- = 0, if the modification times are the same;
- > 0, if file1 was modified more recently than file2.
FILEPATHAPI int filepath_copyfile | ( | const ucs2char_t * | src, | |
const ucs2char_t * | dst | |||
) |
Copy a file.
- Parameters:
-
src The name of a source file to be copied. dst The name of a destination to be created.
- Return values:
-
int True if succeeded, false otherwise.
FILEPATHAPI int filepath_file_exists | ( | const ucs2char_t * | path | ) |
Test the existence of a file.
- Parameters:
-
path The filepath name to be tested.
- Return values:
-
int True or false.
FILEPATHAPI int filepath_hasext | ( | const ucs2char_t * | filename, | |
const ucs2char_t * | ext | |||
) |
Test a file name has an extension.
- Parameters:
-
filename The file name to be tested. ext The extension.
- Return values:
-
int True or false.
FILEPATHAPI int filepath_is_dir | ( | const ucs2char_t * | path | ) |
Test if a filepath name represents a directory.
- Parameters:
-
path The filepath name to be tested.
- Return values:
-
int True or false.
FILEPATHAPI int filepath_is_relative | ( | const ucs2char_t * | path | ) |
Test if a filepath name represents a relative path.
- Parameters:
-
path The filepath name to be tested.
- Return values:
-
int True or false.
FILEPATHAPI int filepath_is_same_root | ( | const ucs2char_t * | path1, | |
const ucs2char_t * | path2 | |||
) |
Test if two path names has a common prefix of a directory.
- Parameters:
-
path1 A filepath name. path2 Another filepath name.
- Return values:
-
int True or false.
FILEPATHAPI time_t filepath_mtime | ( | const ucs2char_t * | filename | ) |
Obtain the last-modified time of a file.
- Parameters:
-
filename The filepath name.
- Return values:
-
time_t The time stamp when the file was updated most recently.
FILEPATHAPI int filepath_removefile | ( | const ucs2char_t * | file | ) |
Remove a file.
- Parameters:
-
file The name of a file to be removed.
- Return values:
-
int True if succeeded, false otherwise.
FILEPATHAPI uint32_t filepath_size | ( | const ucs2char_t * | filename | ) |
Obtain the size of a file.
- Parameters:
-
filename The filepath name.
- Return values:
-
uint32_t The size, in bytes, of the file.
FILEPATHAPI int find_file | ( | const ucs2char_t * | path, | |
int | recursive, | |||
filepath_findfile_callback | callback, | |||
void * | instance | |||
) |
Find files.
- Parameters:
-
path The directory in which this function starts the search. recursive Non-zero value to search files recursively under the directory path
.callback The pointer to the callback function to receive the names of found files. instance A user-defined instance value that will be sent to the callback function.
- Return values:
-
int Reserved.