Preparing search index...

    Represents a file path within a Lens Studio project, combining a root-relative path with a source root directory.

        const sp = new Editor.Model.SourcePath(
    new Editor.Path('Textures/logo.png'),
    Editor.Model.SourceRootDirectory.Assets
    );

    console.log(`toString: ${sp.toString()}`);
    console.log(`extension: ${sp.extension}`);
    console.log(`fileName: ${sp.fileName}`);
    console.log(`fileNameBase: ${sp.fileNameBase}`);
    console.log(`isEmpty: ${sp.isEmpty}`);
    console.log(`parent: ${sp.parent}`);
    console.log(`relativeToProject: ${sp.relativeToProject}`);
    console.log(`relativeToRoot: ${sp.relativeToRoot}`);
    console.log(`rootDirectory: ${sp.rootDirectory}`);

    console.log(`hasExtension('.png'): ${sp.hasExtension('.png')}`);
    console.log(`hasExtension('.jpg'): ${sp.hasExtension('.jpg')}`);

    const replaced = sp.replaceFileNameBase('icon');
    console.log(`After replaceFileNameBase('icon'): ${replaced.toString()}`);
    Index

    Constructors

    Properties

    extension: string

    File extension of the path, including the leading dot.

    fileName: Path

    File name portion of the path as an Editor.Path.

    fileNameBase: string

    File name without extension.

    isEmpty: boolean

    True if the path is empty or unset.

    parent: SourcePath

    Parent directory of the path as a SourcePath.

    relativeToProject: Path

    Path relative to the project root.

    relativeToRoot: Path

    Path relative to the source root directory.

    rootDirectory: Path

    Source root directory this path is anchored to.

    Methods

    • Returns true if the path's file extension matches the given extension string.

      Parameters

      • extension: string

      Returns boolean

    • Returns a new SourcePath with the file name base replaced by the given string.

      Parameters

      • newBaseName: string

      Returns SourcePath

    • Returns the full path as a string.

      Returns string