libcw/cwFileSys.h

46 lines
1.4 KiB
C
Raw Normal View History

2019-12-19 03:24:12 +00:00
#ifndef cwFileSys_H
#define cwFileSys_H
namespace cw
{
// Test the type of a file system object:
//
bool fileSysIsDir( const char* dirStr ); //< Return true if 'dirStr' refers to an existing directory.
bool fileSysIsFile( const char* fnStr ); //< Return true if 'fnStr' refers to an existing file.
bool fileSysIsLink( const char* fnStr ); //< Return true if 'fnStr' refers to a symbolic link.
// Create File Names:
//
// Create a file name by concatenating sub-strings.
//
// Variable arg's. entries are directories inserted between
// 'dirPrefixStr' and the file name.
// Terminate var arg's directory list with a nullptr.
//
// The returned string must be released by a call to memRelease() or memFree().
char* fileSysVMakeFn( const char* dir, const char* fn, const char* ext, va_list vl );
char* fileSysMakeFn( const char* dir, const char* fn, const char* ext, ... );
// Parse a path into its parts:
//
// Return record used by fileSysParts()
typedef struct
{
const char* dirStr;
const char* fnStr;
const char* extStr;
} fileSysPathPart_t;
// Given a file name decompose it into a directory string, file name string and file extension string.
// The returned record and the strings it points to are contained in a single block of
// memory which must be released by a call to memRelease() or memFree()
fileSysPathPart_t* fileSysPathParts( const char* pathNameStr );
}
#endif