How to use the @theia/filesystem/lib/common.FileSystemUtils.tildifyPath function in @theia/filesystem

To help you get started, we’ve selected a few @theia/filesystem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / workspace / src / browser / quick-open-workspace.ts View on Github external
}
        for (const workspace of workspaces) {
            const uri = new URI(workspace);
            const stat = await this.fileSystem.getFileStat(workspace);
            if (!stat ||
                !this.preferences['workspace.supportMultiRootWorkspace'] && !stat.isDirectory) {
                continue; // skip the workspace files if multi root is not supported
            }
            if (tempWorkspaceFile && uri.toString() === tempWorkspaceFile.toString()) {
                continue; // skip the temporary workspace files
            }
            const icon = this.labelProvider.getIcon(stat);
            const iconClass = icon === '' ? undefined : icon + ' file-icon';
            this.items.push(new QuickOpenGroupItem({
                label: uri.path.base,
                description: (home) ? FileSystemUtils.tildifyPath(uri.path.toString(), home) : uri.path.toString(),
                groupLabel: `last modified ${moment(stat.lastModification).fromNow()}`,
                iconClass,
                run: (mode: QuickOpenMode): boolean => {
                    if (mode !== QuickOpenMode.OPEN) {
                        return false;
                    }
                    const current = this.workspaceService.workspace;
                    const uriToOpen = new URI(workspace);
                    if ((current && current.uri !== workspace) || !current) {
                        this.workspaceService.open(uriToOpen);
                    }
                    return true;
                },
            }));
        }