getWorkspaceFolder

Supported from HBuilderX 2.7.12+

Returns the workspace folder that contains a given uri.

Parameter

Name Type Description
uri String or Uri File absolute path or file Uri

Returns

Type Description
Promise<WorkspaceFolder> The project where the file is located.

Example

  1. var wsPromise = hx.workspace.getWorkspaceFolder("%fsPath%");
  2. wsPromise.then(function(wsFolder) {
  3. console.log("The project where the file is located:",wsFolder.name);
  4. });

WorkspaceFolder

The project directory under the workspace, each project in the project manager on the left represents a WorkspaceFolder

Attribute list

Attribute name Type Description
uri String or Uri Project directory path
name String Project Name
nature String project type
id String Project unique id