LICK
 All Data Structures Files Functions Variables Enumerations Enumerator
fs-utils.h
Go to the documentation of this file.
1 
6 #pragma once
7 
11 typedef enum {
18 } file_type_e;
19 
25 char *win_path(char *path);
31 char *unix_path(char *path);
37 int make_dir(const char *d);
43 int make_dir_parents(const char *d);
50 int copy_file(const char *dst, const char *src);
57 int rename_file(const char *dst, const char *src);
64 int replace_file(const char *dst, const char *src);
70 int unlink_dir(const char *d);
76 int unlink_dir_parents(const char *d);
82 int unlink_file(const char *f);
88 int unlink_recursive(const char *d);
94 file_type_e file_type(const char *path);
100 int path_exists(const char *path);
101 
102 
103 #ifdef _WIN32
104 #include <stdint.h>
105 typedef uint32_t attrib_t;
106 #else
107 typedef char attrib_t;
108 #endif
109 
115 attrib_t attrib_get(const char *file);
121 attrib_t attrib_open(const char *file);
127 void attrib_save(const char *file, attrib_t attrib);
other
Definition: fs-utils.h:13
int path_exists(const char *path)
determine if a file or directory exists
Definition: fs-utils.c:192
char * win_path(char *path)
normalizes the path str to a Windows path
Definition: fs-utils.c:39
int unlink_dir_parents(const char *d)
delete a directory if it is empty, and repeat with each parent directory
Definition: fs-utils.c:132
int unlink_file(const char *f)
delete a file
Definition: fs-utils.c:159
attrib_t attrib_open(const char *file)
get the attributes of a file, and set the file attributes for writing
Definition: fs-utils.c:215
int unlink_dir(const char *d)
delete a directory
Definition: fs-utils.c:127
file_type_e file_type(const char *path)
determine the type of a file
Definition: fs-utils.c:183
int rename_file(const char *dst, const char *src)
rename a file or directory
Definition: fs-utils.c:114
int replace_file(const char *dst, const char *src)
replace a file or directory
Definition: fs-utils.c:118
file_type_e
Definition: fs-utils.h:11
int copy_file(const char *dst, const char *src)
copy a file
Definition: fs-utils.c:84
a directory
Definition: fs-utils.h:17
int unlink_recursive(const char *d)
delete a directory and its contents
Definition: fs-utils.c:164
attrib_t attrib_get(const char *file)
get the attributes of a file
Definition: fs-utils.c:212
char * unix_path(char *path)
normalizes the path str to a Unix path
Definition: fs-utils.c:43
void attrib_save(const char *file, attrib_t attrib)
restore the attributes of a file
Definition: fs-utils.c:218
a file
Definition: fs-utils.h:15
int make_dir(const char *d)
create a directory
Definition: fs-utils.c:47
int make_dir_parents(const char *d)
creating a directory and its parents as necessary
Definition: fs-utils.c:61