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 clearStartupCache();
100 static void getHomeHoudini(
UT_String &str);
108 void extendPath(
const char *defpath = 0,
110 const char *carat_expand = 0,
117 bool appendPath(
const char *path,
bool condensed =
false);
121 bool removePath(
const char *path);
127 bool prependPath(
const char *path,
bool condensed =
false);
131 int findFile(
UT_WorkBuffer &result,
const char *search)
const;
132 int findDirectory(
UT_String &result,
const char *search)
const;
138 bool findDirectoryFromList(
UT_String &result,
144 int findAllFiles(
const char *search,
147 int findAllDirectories(
const char *search,
154 bool returnfullpaths,
157 bool skip_dup_paths=
false)
const;
164 bool returnfullpaths,
167 bool skip_dup_paths=
false)
const;
169 int matchAllFilesInSubdirectory(
const char *extension,
170 const char *subdirectory,
171 bool returnfullpaths,
174 bool skip_dup_paths=
false)
const;
176 const char *subdirectory,
177 bool returnfullpaths,
180 bool skip_dup_paths=
false)
const;
185 int houdiniFindFile(
const char *
find,
UT_String &result)
const;
186 int houdiniFindFile(
const char *find,
UT_WorkBuffer &result)
const;
188 int houdiniFindDirectory(
const char *find,
UT_String &result)
const;
189 int houdiniFindDirectory(
const char *find,
UT_WorkBuffer &
r)
const;
199 {
return myCondensedPaths(i); }
220 enum { NUM_PATHS = 8 };
222 int size()
const {
return NUM_PATHS; }
223 const char *
hip()
const {
return myPaths[2]; }
225 const char *myPaths[NUM_PATHS];
226 const char *myCondensedPaths[NUM_PATHS];
239 return condenseCommon(path, path, common);
249 return condenseCommon(path, path.
buffer(), common);
259 return condenseCommon(condensed, path, common);
269 return condenseCommon(condensed, path, common);
275 return condenseCommon(path, path, common);
281 return condenseCommon(path, path.
buffer(), common);
288 return condensePath(path, source_path, common.
myPaths,
296 return condensePath(path, source_path, common.
myPaths,
306 const char *source_path,
307 const char *
const paths[],
308 const char *
const condensed_paths[],
313 const char *source_path,
314 const char *
const paths[],
315 const char *
const condensed_paths[],
319 bool ok = condensePath(condensed, source_path,
320 paths, condensed_paths, npaths);
323 else if (path.
buffer() != source_path)
330 const char *
const paths[],
331 const char *
const condensed_paths[],
334 return condensePath(path, path, paths, condensed_paths, npaths);
351 static bool resolveAbsolutePath(
const char *
filename,
368 const char *insert_path);
383 bool returnfullpaths,
403 houdiniFindFile(find, result))
412 houdiniFindFile(find, result))
414 return result.
length() != 0;
422 findAllFiles(find, result);
430 houdiniFindDirectory(find, result))
439 houdiniFindDirectory(find, result))
441 return result.
length() != 0;
449 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