Editor.Path
ClassA path in the filesystem, or Asset Manager.
A path in the filesystem, or Asset Manager. Useful for things like importing files into Lens Studio through the Editor.Model.AssetManager.
Index
Properties
Methods
Example
// Get access to the project's assetManager
const model = this.pluginSystem.findInterface(Editor.Model.IModel);
const assetManager = model.project.assetManager;
// Locate the shader pass we want to import
const resourceLoc = import.meta.resolve('Resources/myMesh.ss_graph');
const absGraphPath = new Editor.Path(resourceLoc);
// Import the shader pass
const pathInAssetManager = new Editor.Path('');
const meta = await assetManager.importExternalFileAsync(absolutePath, pathInAssetManager, Editor.Model.ResultType.Packed);
Constructors
Constructor
new Path(
str):Path
Construct a new path object.
Parameters
| Parameter | Type |
|---|---|
str | string |
Returns
Path
Properties
extension
readonlyextension:string
The extension of the file of the current path object (without dot).
fileName
readonlyfileName:Path
The name of the file, including its extension, in the current path object.
fileNameBase
readonlyfileNameBase:string
The name of the file, without its extension, in the current path object.
isEmpty
readonlyisEmpty:boolean
Whether the path string is empty.
parent
readonlyparent:Path
A path to the parent folder of the current path object.
Methods
appended()
appended(
path):Path
Returns a new path object relative to the rootPath.
Parameters
| Parameter | Type |
|---|---|
path | Path |
Returns
Path
equals()
staticequals(lhs,rhs):boolean
Returns true if this path is equal to the given path.
Parameters
| Parameter | Type |
|---|---|
lhs | Path |
rhs | Path |
Returns
boolean
hasExtension()
hasExtension(
extension):boolean
Whether the path object has a file extension in the end.
Parameters
| Parameter | Type |
|---|---|
extension | string |
Returns
boolean
isInside()
isInside(
directory):boolean
Whether the current path is inside directory.
Parameters
| Parameter | Type |
|---|---|
directory | Path |
Returns
boolean
relative()
relative(
rootPath):Path
Returns a new path object relative to the rootPath.
Parameters
| Parameter | Type |
|---|---|
rootPath | Path |
Returns
Path
replaceExtension()
replaceExtension(
newExtension):Path
Rename the extension of the file.
Parameters
| Parameter | Type |
|---|---|
newExtension | string |
Returns
Path
replaceFileNameBase()
replaceFileNameBase(
name):Path
Returns a new path with the file name base replaced by the given string, preserving extension and directory.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
Path
toString()
toString():
string
Returns the current path as a string.
Returns
string