HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_DirUtil.h File Reference
#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>
+ Include dependency graph for UT_DirUtil.h:
+ This graph shows which files directly or indirectly include this file:

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_StringArrayUTgetAbsolutePathPrefixes ()
 
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 UTnormalizeFilePath (UT_String &path)
 
UT_API void UTnormalizeFilePath (UT_StringHolder &path)
 
UT_API bool UTisHiddenFile (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...
 

Function Documentation

UT_API char* getUnixCwd ( char *  buffer,
int  maxlen 
)

Get the current working directory.

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 void UTaddAbsolutePathPrefix ( const char *  prefix)
Examples:
FS/FS_HomeHelper.C.
UT_API bool UTfileExists ( const char *  path)

Returns true if file path exists, without permission checks. This is optimized for known platforms.

UT_API int UTfullPathSpecified ( const char *  name)
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.

UT_API int UTgetRootPrefixLength ( const char *  filename)

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 *  filename)
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.

UT_API void UTmakeAbsoluteFilePath ( UT_String path,
const char *  basepath = nullptr 
)

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.

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 UTnormalizeFilePath ( UT_String path)

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)
UT_API int UTunixFullPathSpecified ( const char *  name)