39 #ifndef __UT_PathSearch__
40 #define __UT_PathSearch__
61 const char *carat_expand =
"",
68 static void pathMapLoad(
const char *dict);
69 static void pathMapAdd(
const char *
src,
const char *dest,
71 static bool pathMapRemove(
const char *src);
89 static void rehashAll();
95 static void refreshStartupPathCacheDirectory(
const UT_StringHolder &directory_path);
96 static void clearStartupCache();
101 static void getHomeHoudini(
UT_String &str);
109 void extendPath(
const char *defpath = 0,
111 const char *carat_expand = 0,
118 bool appendPath(
const char *path,
bool condensed =
false);
122 bool removePath(
const char *path);
128 bool prependPath(
const char *path,
bool condensed =
false);
132 int findFile(
UT_WorkBuffer &result,
const char *search)
const;
133 int findDirectory(
UT_String &result,
const char *search)
const;
139 bool findDirectoryFromList(
UT_String &result,
145 int findAllFiles(
const char *search,
148 int findAllDirectories(
const char *search,
155 bool returnfullpaths,
158 bool skip_dup_paths=
false)
const;
165 bool returnfullpaths,
168 bool skip_dup_paths=
false)
const;
170 int matchAllFilesInSubdirectory(
const char *extension,
171 const char *subdirectory,
172 bool returnfullpaths,
175 bool skip_dup_paths=
false)
const;
177 const char *subdirectory,
178 bool returnfullpaths,
181 bool skip_dup_paths=
false)
const;
186 int houdiniFindFile(
const char *
find,
UT_String &result)
const;
187 int houdiniFindFile(
const char *find,
UT_WorkBuffer &result)
const;
189 int houdiniFindDirectory(
const char *find,
UT_String &result)
const;
190 int houdiniFindDirectory(
const char *find,
UT_WorkBuffer &
r)
const;
200 {
return myCondensedPaths(i); }
221 enum { NUM_PATHS = 8 };
223 int size()
const {
return NUM_PATHS; }
224 const char *
hip()
const {
return myPaths[2]; }
226 const char *myPaths[NUM_PATHS];
227 const char *myCondensedPaths[NUM_PATHS];
240 return condenseCommon(path, path, common);
250 return condenseCommon(path, path.
buffer(), common);
260 return condenseCommon(condensed, path, common);
270 return condenseCommon(condensed, path, common);
276 return condenseCommon(path, path, common);
282 return condenseCommon(path, path.
buffer(), common);
289 return condensePath(path, source_path, common.
myPaths,
297 return condensePath(path, source_path, common.
myPaths,
307 const char *source_path,
308 const char *
const paths[],
309 const char *
const condensed_paths[],
314 const char *source_path,
315 const char *
const paths[],
316 const char *
const condensed_paths[],
320 bool ok = condensePath(condensed, source_path,
321 paths, condensed_paths, npaths);
324 else if (path.
buffer() != source_path)
331 const char *
const paths[],
332 const char *
const condensed_paths[],
335 return condensePath(path, path, paths, condensed_paths, npaths);
352 static bool resolveAbsolutePath(
const char *
filename,
369 const char *insert_path);
384 bool returnfullpaths,
404 houdiniFindFile(find, result))
413 houdiniFindFile(find, result))
415 return result.
length() != 0;
423 findAllFiles(find, result);
431 houdiniFindDirectory(find, result))
440 houdiniFindDirectory(find, result))
442 return result.
length() != 0;
450 findAllDirectories(find, result);
static const UT_PathSearch * getInstance(UT_KnownPath path_type)
const char * getCondensedComponent(int i) const
path_type
CLI enumeration of different file types.
int HoudiniFindFile(const char *find, UT_String &result)
GT_API const UT_StringHolder filename
SYS_FORCE_INLINE exint length() const
int getBaseEntries() const
static bool condensePath(UT_String &path, const char *const paths[], const char *const condensed_paths[], int npaths)
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
const char * getBaseComponent(int i) const
GLsizei const GLchar *const * path
const char * myPaths[NUM_PATHS]
SYS_FORCE_INLINE const char * buffer() const
void copyIntoString(UT_String &str) const
**But if you need a result
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
static bool condensePath(UT_String &path, const char *source_path, const char *const paths[], const char *const condensed_paths[], int npaths)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
int HoudiniFindDir(const char *find, UT_String &result)
const char * buffer() const
const char * myCondensedPaths[NUM_PATHS]
static bool condenseCommon(UT_WorkBuffer &path, const char *source_path, const CommonPaths &common)
static bool condenseCommon(UT_WorkBuffer &path, const CommonPaths &common)
UT_ValArray< const char * > UT_StringList
static bool condenseCommon(UT_String &path, const char *source_path, const CommonPaths &common)
void harden()
Take shallow copy and make it deep.
#define SYS_NO_DISCARD_RESULT
GLuint const GLchar * name
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
static bool condenseCommon(UT_WorkBuffer &condensed, const char *path)
auto search(const T &set, const V &val) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))>
A search function.
const char * getDefaultPath() const
exint entries() const
Alias of size(). size() is preferred.
const char * getPathComponent(int i) const
static bool condenseCommon(UT_WorkBuffer &path)
int HoudiniFindMulti(const char *find, UT_StringArray &result)
const char * getCaratExpand() const
LeafData & operator=(const LeafData &)=delete
static bool condenseCommon(UT_String &path, const CommonPaths &common)
static bool condenseCommon(UT_String &condensed, const char *path)
SYS_FORCE_INLINE void clear()
int HoudiniFindDirMulti(const char *find, UT_StringArray &result)
void clear()
Resets list to an empty list.
static bool condenseCommon(UT_String &path)
OIIO_UTIL_API std::string extension(string_view filepath, bool include_dot=true) noexcept
int getVariableId() const