HDK
|
#include "UT_API.h"
#include "UT_FileStat.h"
#include <SYS/SYS_Deprecated.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <dirent.h>
#include <unistd.h>
#include <stdlib.h>
Go to the source code of this file.
Functions | |
UT_API int | UTunixFullPathSpecified (const char *name) |
UT_API int | UTfullPathSpecified (const char *name) |
UT_API bool | UTisAbsolutePath (const char *filename) |
UT_API bool | UTisRootPath (const char *filename) |
UT_API int | UTgetRootPrefixLength (const char *filename) |
UT_API const UT_StringArray & | UTgetAbsolutePathPrefixes () |
UT_API void | UTaddAbsolutePathPrefix (const char *prefix) |
UT_API void | UTmakeAbsoluteFilePath (UT_String &path, const char *basepath=nullptr) |
UT_API void | UTmakeAbsoluteFilePath (UT_StringHolder &path, const char *basepath=nullptr) |
UT_API void | UTmakeRelativeFilePath (UT_String &path, const char *basepath=nullptr) |
UT_API void | UTmakeRelativeFilePath (UT_StringHolder &path, const char *basepath=nullptr) |
UT_API void | UTrealPath (UT_String &path) |
UT_API void | UTrealPath (UT_StringHolder &path) |
UT_API void | UTnormalizeFilePath (UT_String &path) |
UT_API void | UTnormalizeFilePath (UT_StringHolder &path) |
UT_API bool | UTisHiddenFile (const char *basepath, const char *filename) |
UT_API bool | UTisValidRegularFile (const char *path) |
UT_API bool | UTisValidDirectory (const char *path) |
Returns true if the given path is a readable directory. More... | |
UT_API bool | UTisDirectory (const char *path) |
Returns true if path is a directory, without permission checks. More... | |
UT_API bool | UTisRegularFile (const char *path) |
Returns true if path is a regular file, without permission checks. More... | |
UT_API bool | UTfileExists (const char *path) |
UT_API char * | getUnixCwd (char *buffer, int maxlen) |
Get the current working directory. More... | |
UT_API int | statLastRead (DIR *dirp, const char *path, UT_FileStat &file_stat) |
Do the equivalent of a stat on the last file from readdir or opendir. More... | |
UT_API int statLastRead | ( | DIR * | dirp, |
const char * | path, | ||
UT_FileStat & | file_stat | ||
) |
Do the equivalent of a stat on the last file from readdir or opendir.
UT_API bool UTfileExists | ( | const char * | path | ) |
Returns true if file path exists, without permission checks. This is optimized for known platforms.
UT_API const UT_StringArray& UTgetAbsolutePathPrefixes | ( | ) |
Functions to manage the set of prefixes which Houdini treats as being valid ways to start an absolute path.
UTgetRootPrefixLength() returns the length of the root part of the file path.
The remainder of the file path after the root part length will have one of the following forms: '/path/to/file' => for absolute paths 'relative/path/to/file' => for relative paths '' => for root paths
Some examples of input file paths and output root lengths: '/path/to/file' => 0 'relative/path/to/file' => 0 'C:/path/to/file' => 2 (Windows only) 'C:relative/path/to/file' => 2 (Windows only) '//path/to/file' => 1 (Windows only) '//path/to/file' => 0 (Unix only) 'file:///path/to/file' => 5 'file:/path/to/file' => 5 'file:relative/path/to/file'=> 5
UT_API bool UTisAbsolutePath | ( | const char * | filename | ) |
UT_API bool UTisDirectory | ( | const char * | path | ) |
Returns true if path is a directory, without permission checks.
UT_API bool UTisHiddenFile | ( | const char * | basepath, |
const char * | filename | ||
) |
Checks if the file name starts with '.'. basepath (parent directory) is ignored in non Windows envirenment, whereas in Windows full path is needed to see if the file has the hidden attribute.
UT_API bool UTisRegularFile | ( | const char * | path | ) |
Returns true if path is a regular file, without permission checks.
UT_API bool UTisRootPath | ( | const char * | filename | ) |
UT_API bool UTisValidDirectory | ( | const char * | path | ) |
Returns true if the given path is a readable directory.
UT_API bool UTisValidRegularFile | ( | const char * | path | ) |
Returns true if the given path is a readable, regular file, ie. not a directory.
Functions to convert absolute paths into relative paths and vice versa, given a path and a "base" path which is used as the root location for relative paths. When basepath is not given, getUnixCwd() will be used.
UT_API void UTmakeAbsoluteFilePath | ( | UT_StringHolder & | path, |
const char * | basepath = nullptr |
||
) |
UT_API void UTmakeRelativeFilePath | ( | UT_StringHolder & | path, |
const char * | basepath = nullptr |
||
) |
Normalizes a file path. This means ensuring all slashes are forward slashes, removing redundant slashes, and collapsing '..' and '.' components as much as possible (whether they occur at the start or in the middle of the path).
UT_API void UTnormalizeFilePath | ( | UT_StringHolder & | path | ) |
Resolves symlinks, symbolic links on a path. Calls ::realpath() or fs::canonical() depdending of the platform.
UT_API void UTrealPath | ( | UT_StringHolder & | path | ) |