LICK
 All Data Structures Files Functions Variables Enumerations Enumerator
Typedefs | Enumerations | Functions
fs-utils.h File Reference

An assortment of functions used to manipulate paths and directories. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef char attrib_t
 

Enumerations

enum  file_type_e { FILE_TYPE_OTHER, FILE_TYPE_FILE, FILE_TYPE_DIR }
 

Functions

char * win_path (char *path)
 normalizes the path str to a Windows path More...
 
char * unix_path (char *path)
 normalizes the path str to a Unix path More...
 
int make_dir (const char *d)
 create a directory More...
 
int make_dir_parents (const char *d)
 creating a directory and its parents as necessary More...
 
int copy_file (const char *dst, const char *src)
 copy a file More...
 
int rename_file (const char *dst, const char *src)
 rename a file or directory More...
 
int replace_file (const char *dst, const char *src)
 replace a file or directory More...
 
int unlink_dir (const char *d)
 delete a directory More...
 
int unlink_dir_parents (const char *d)
 delete a directory if it is empty, and repeat with each parent directory More...
 
int unlink_file (const char *f)
 delete a file More...
 
int unlink_recursive (const char *d)
 delete a directory and its contents More...
 
file_type_e file_type (const char *path)
 determine the type of a file More...
 
int path_exists (const char *path)
 determine if a file or directory exists More...
 
attrib_t attrib_get (const char *file)
 get the attributes of a file More...
 
attrib_t attrib_open (const char *file)
 get the attributes of a file, and set the file attributes for writing More...
 
void attrib_save (const char *file, attrib_t attrib)
 restore the attributes of a file More...
 

Detailed Description

An assortment of functions used to manipulate paths and directories.

Enumeration Type Documentation

The type of a file

Enumerator
FILE_TYPE_OTHER 

other

FILE_TYPE_FILE 

a file

FILE_TYPE_DIR 

a directory

Function Documentation

attrib_t attrib_get ( const char *  file)

get the attributes of a file

Parameters
filethe file
Returns
the attributes of the file
attrib_t attrib_open ( const char *  file)

get the attributes of a file, and set the file attributes for writing

Parameters
filethe file
Returns
the old attributes of the file
void attrib_save ( const char *  file,
attrib_t  attrib 
)

restore the attributes of a file

Parameters
filethe file
attribthe old attributes
int copy_file ( const char *  dst,
const char *  src 
)

copy a file

Parameters
dstthe absolute path of a new file
srcthe path of a file to make a copy of
Returns
true on success
file_type_e file_type ( const char *  path)

determine the type of a file

Parameters
pathto the file or directory to check
Returns
a file_type_e corresponding to the type of file
int make_dir ( const char *  d)

create a directory

Parameters
dthe directory to create
Returns
true on success
int make_dir_parents ( const char *  d)

creating a directory and its parents as necessary

Parameters
dthe directory to create
Returns
true on success
int path_exists ( const char *  path)

determine if a file or directory exists

Parameters
paththe file to check
Returns
1 if the file exists, otherwise 0
int rename_file ( const char *  dst,
const char *  src 
)

rename a file or directory

Parameters
dstthe absolute path of the new name
srcthe path of what is being renamed
Returns
true on success
int replace_file ( const char *  dst,
const char *  src 
)

replace a file or directory

Parameters
dstthe absolute path of the new name
srcthe path of what is being replaced
Returns
true on success
char* unix_path ( char *  path)

normalizes the path str to a Unix path

Parameters
paththe path to normalize
Returns
a reference to path
int unlink_dir ( const char *  d)

delete a directory

Parameters
dthe directory to delete
Returns
true on success
int unlink_dir_parents ( const char *  d)

delete a directory if it is empty, and repeat with each parent directory

Parameters
dthe directory to delete
Returns
true if at least one directory was deleted
int unlink_file ( const char *  f)

delete a file

Parameters
fthe file to delete
Returns
true on success
int unlink_recursive ( const char *  d)

delete a directory and its contents

Parameters
dthe directory to delete
Returns
true on success
char* win_path ( char *  path)

normalizes the path str to a Windows path

Parameters
paththe path to normalize
Returns
a reference to path