file utility More...
Go to the source code of this file.
Macros | |
#define | ZFFileCloseHolder(token) |
util method to call ZFFileClose after code block | |
#define | ZFResCloseHolder(token) |
util method to call ZFResClose after code block | |
#define | ZFPathInfoCloseHolder(pathInfo, token) |
util method to call ZFPathInfoClose after code block | |
Functions | |
zfbool | ZFPathFormatT (zfstring &ret, const zfchar *src, zfindex srcLen=(((zfindex) -1))) |
format path | |
zfstring | ZFPathFormat (const zfchar *src, zfindex srcLen=(((zfindex) -1))) |
see ZFPathFormatT | |
zfbool | ZFPathFormatRelativeT (zfstring &ret, const zfchar *src, zfindex srcLen=(((zfindex) -1))) |
util method to resolve ".." in path | |
zfstring | ZFPathFormatRelative (const zfchar *src, zfindex srcLen=(((zfindex) -1))) |
see ZFPathFormatRelativeT | |
zfbool | ZFFileNameOfT (zfstring &ret, const zfchar *src) |
get file name from path or src if error, e.g. "file.ext" from "/path/file.ext" | |
zfstring | ZFFileNameOf (const zfchar *src) |
see ZFFileNameOfT | |
zfbool | ZFFileNameOfWithoutExtT (zfstring &ret, const zfchar *src) |
get file name without extension from path or src if error, e.g. "file.ext0" from "/path/file.ext0.ext1" | |
zfstring | ZFFileNameOfWithoutExt (const zfchar *src) |
see ZFFileNameOfWithoutExtT | |
zfbool | ZFFileExtOfT (zfstring &ret, const zfchar *src) |
get file extension from path or empty if error, e.g. "ext1" from "/path/file.ext0.ext1", or empty if no extension | |
zfstring | ZFFileExtOf (const zfchar *src) |
see ZFFileExtOfT | |
zfbool | ZFPathOfWithoutExtT (zfstring &ret, const zfchar *src) |
get file path without ext, e.g. "/path/file.ext0" from "/path/file.ext0.ext1", or original string if no extension | |
zfstring | ZFPathOfWithoutExt (const zfchar *src) |
see ZFPathOfWithoutExtT | |
zfbool | ZFPathOfWithoutAllExtT (zfstring &ret, const zfchar *src) |
get file path without all ext, e.g. "/path/file" from "/path/file.ext0.ext1", or original string if no extension | |
zfstring | ZFPathOfWithoutAllExt (const zfchar *src) |
see ZFPathOfWithoutAllExtT | |
zfbool | ZFPathParentOfT (zfstring &ret, const zfchar *src) |
get parent path | |
zfstring | ZFPathParentOf (const zfchar *src) |
see ZFPathParentOfT | |
zfbool | ZFPathComponentsOfT (ZFCoreArray< zfstring > &ret, const zfchar *src) |
get each file components from path or empty if error, e.g. {"path", "file.ext"}(as array) from "/path/file.ext" | |
ZFCoreArray< zfstring > | ZFPathComponentsOf (const zfchar *src) |
see ZFPathComponentsOfT | |
void | ZFPathInfoTreePrint (const ZFPathInfo &pathInfo, const ZFOutput &outputCallback=(ZFOutputDefault()), const zfchar *headToken=(zft_zfnull), const zfchar *indentToken=(" ")) |
list all files, usually for debug use | |
zfbool | ZFPathInfoForEach (const ZFPathInfo &pathInfo, const ZFListener &fileCallback, zfbool isRecursive=(_ZFT_t_zftrue)) |
util method to loop each child file or dir in specified pathInfo | |
zfbool | ZFPathInfoForEachFile (const ZFPathInfo &pathInfo, const ZFListener &fileCallback, zfbool isRecursive=(_ZFT_t_zftrue)) |
util method to loop each file, see ZFPathInfoForEach | |
zfbool | ZFPathInfoForEachDir (const ZFPathInfo &pathInfo, const ZFListener &fileCallback, zfbool isRecursive=(_ZFT_t_zftrue)) |
util method to loop each dir, see ZFPathInfoForEach | |
file utility
|
extern |
format path
format rules:
xxx://
)xxx://
)get file name from path or src if error, e.g. "file.ext" from "/path/file.ext"
get file name without extension from path or src if error, e.g. "file.ext0" from "/path/file.ext0.ext1"
get file extension from path or empty if error, e.g. "ext1" from "/path/file.ext0.ext1", or empty if no extension
get file path without ext, e.g. "/path/file.ext0" from "/path/file.ext0.ext1", or original string if no extension
get file path without all ext, e.g. "/path/file" from "/path/file.ext0.ext1", or original string if no extension
get parent path
return empty string if no parent found
|
extern |
get each file components from path or empty if error, e.g. {"path", "file.ext"}(as array) from "/path/file.ext"
|
extern |
util method to loop each child file or dir in specified pathInfo
usage:
fileCallback's param0 is v_ZFPathInfo that describe the child file or dir, and param1 is v_ZFFileFindData, set ZFArgs::eventFiltered to indicates process done