HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
packageUtils.h File Reference
#include "pxr/pxr.h"
#include "pxr/usd/ar/api.h"
#include <string>
#include <vector>
+ Include dependency graph for packageUtils.h:

Go to the source code of this file.

Functions

Package Relative Paths

Assets within package assets can be addressed via "package-relative" paths. For example, given a hypothetical package "Model.package", the asset "Geom.file", can be referred to using the path "Model.package[Geom.file]".

A package-relative path consists of two parts:

  • The outer "package" path is the path to the containing package asset. This path can be whatever is appropriate to the client's asset system.
  • The inner "packaged" path is the path to an asset contained within the package asset. This path must be a relative path delimited by forward slashes '/', with no leading slashes or drive or device letters. Note that packaged paths may themselves be package-relative paths, since package assets may be nested.

Examples:

  • /path/to/Model.package[a/b/Geom.file]
  • /path/to/Model.package[a/b/Sub.package[c/d/Geom.file]]
AR_API bool ArIsPackageRelativePath (const std::string &path)
 Return true if path is a package-relative path, false otherwise. More...
 
AR_API std::string ArJoinPackageRelativePath (const std::vector< std::string > &paths)
 
AR_API std::string ArJoinPackageRelativePath (const std::pair< std::string, std::string > &paths)
 
AR_API std::string ArJoinPackageRelativePath (const std::string &packagePath, const std::string &packagedPath)
 
AR_API std::pair< std::string,
std::string
ArSplitPackageRelativePathOuter (const std::string &path)
 
AR_API std::pair< std::string,
std::string
ArSplitPackageRelativePathInner (const std::string &path)
 

Detailed Description

Utility functions for working with package assets

Definition in file packageUtils.h.

Function Documentation

AR_API bool ArIsPackageRelativePath ( const std::string path)

Return true if path is a package-relative path, false otherwise.

AR_API std::string ArJoinPackageRelativePath ( const std::vector< std::string > &  paths)

Combines the given paths into a single package-relative path, nesting paths as necessary.

ArJoinPackageRelativePath(["a.pack", "b.pack"])
=> "a.pack[b.pack]"
ArJoinPackageRelativePath(["a.pack", "b.pack", "c.pack"])
=> "a.pack[b.pack[c.pack]]"
ArJoinPackageRelativePath(["a.pack[b.pack]", "c.pack"])
=> "a.pack[b.pack[c.pack]]"
AR_API std::string ArJoinPackageRelativePath ( const std::pair< std::string, std::string > &  paths)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

AR_API std::string ArJoinPackageRelativePath ( const std::string packagePath,
const std::string packagedPath 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

AR_API std::pair<std::string, std::string> ArSplitPackageRelativePathInner ( const std::string path)

Split package-relative path path into a (package path, packaged path) pair. If packageRelativePath contains nested package-relative paths the package path will be the outermost package-relative path, and the packaged path will be the innermost packaged path.

=> ("a.pack", "b.pack")
ArSplitPackageRelativePathInner("a.pack[b.pack[c.pack]]")
=> ("a.pack[b.pack]", "c.pack")
AR_API std::pair<std::string, std::string> ArSplitPackageRelativePathOuter ( const std::string path)

Split package-relative path path into a (package path, packaged path) pair. If packageRelativePath contains nested package-relative paths the package path will be the outermost package path, and the packaged path will be the inner package-relative path.

=> ("a.pack", "b.pack")
ArSplitPackageRelativePathOuter("a.pack[b.pack[c.pack]]")
=> ("a.pack", "b.pack[c.pack]")