当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fs-extra-promise.lstatAsync函数代码示例

本文整理汇总了TypeScript中fs-extra-promise.lstatAsync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript lstatAsync函数的具体用法?TypeScript lstatAsync怎么用?TypeScript lstatAsync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了lstatAsync函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getLaunchFilePath

function getLaunchFilePath(filePathOrFolder: string): Promise<string> {
    return fs.lstatAsync(filePathOrFolder).then(stats => {
        // If a file path was passed, assume its the launch file.
        if (stats.isFile()) {
            return filePathOrFolder;
        }

        // Otherwise, search the specified folder.
        let candidate: string;
        
        candidate = path.join(filePathOrFolder, runFileName);
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        candidate = path.join(filePathOrFolder, omnisharpFileName);
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        candidate = path.join(filePathOrFolder, omnisharpExeFileName);
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        throw new Error(`Could not fnd launch file in ${filePathOrFolder}. Expected '${runFileName}', '${omnisharpFileName}', or '${omnisharpExeFileName}'.`);
    });
}
开发者ID:bertlacy,项目名称:omnisharp-vscode,代码行数:28,代码来源:path.ts

示例2: findServerPath

    /**
     * Given a file path, returns the path to the SQL Tools service file.
     */
    public findServerPath(filePath: string, executableFiles: string[] = undefined): Promise<string> {
        return fs.lstatAsync(filePath).then(stats => {
            // If a file path was passed, assume its the launch file.
            if (stats.isFile()) {
                return filePath;
            }

            // Otherwise, search the specified folder.
            let candidate: string;

            if (executableFiles === undefined && this._config !== undefined) {
                executableFiles = this._config.getExecutableFiles();
            }
            if (executableFiles !== undefined) {
                executableFiles.forEach(element => {
                    let executableFile = path.join(filePath, element);
                    if (candidate === undefined && fs.existsSync(executableFile)) {
                        candidate = executableFile;
                        return candidate;
                    }
                });
            }


            return candidate;
        });
    }
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:30,代码来源:server.ts

示例3: stat_file

export async function stat_file(file_name: string): Promise<any>{
	await lock.acquire();
	let out: any; 
	try{
		out = await fs.lstatAsync(file_name);
	}
	finally{
		lock.release();
	}
	return out;
}
开发者ID:BelaPlatform,项目名称:Bela,代码行数:11,代码来源:FileManager.ts

示例4: runDotnetRestore

    return projects.map(project => {
        let projectDirectory = project.Path;

        return fs.lstatAsync(projectDirectory).then(stats => {
            if (stats.isFile()) {
                projectDirectory = path.dirname(projectDirectory);
            }

            return {
                label: `dotnet restore - (${project.Name || path.basename(project.Path)})`,
                description: projectDirectory,
                execute() {
                    return runDotnetRestore(projectDirectory);
                }
            };
        });
    });
开发者ID:bertlacy,项目名称:omnisharp-vscode,代码行数:17,代码来源:commands.ts

示例5: findServerPath

export function findServerPath(filePath: string): Promise<string> {
    return fs.lstatAsync(filePath).then(stats => {
        // If a file path was passed, assume its the launch file.
        if (stats.isFile()) {
            return filePath;
        }

        // Otherwise, search the specified folder.
        let candidate: string;
        
        candidate = path.join(filePath, 'OmniSharp.exe');
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        candidate = path.join(filePath, 'OmniSharp');
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        throw new Error(`Could not find OmniSharp launch file in ${filePath}.`);
    });
}
开发者ID:Firaenix,项目名称:omnisharp-vscode,代码行数:23,代码来源:omnisharp.ts


注:本文中的fs-extra-promise.lstatAsync函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。