• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript path.join类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getDataRelativePath

function getDataRelativePath(...paths: string[]) {
    let args = _.toArray(arguments);

    args.unshift(getDataPath());

    return path.join.apply(this, args);
}
开发者ID:yegor-sytnyk,项目名称:contoso-express,代码行数:7,代码来源:pathHelper.ts


示例2: tryFindSourcePathInNSProject

function tryFindSourcePathInNSProject(nsProjectPath: string, additionalFileExtension: string, resorcePath: string) : string {
    let guesses = [];
    const pathParts = resorcePath.split(path.sep);
    let appIndex = pathParts.indexOf("app");
    let isTnsModule = appIndex >= 0 && pathParts.length > appIndex + 1 && pathParts[appIndex + 1] === "tns_modules";
    //let isTnsModule: boolean = (pathParts.length >= 3 && pathParts[0] == '' && pathParts[1] == 'app' && pathParts[2] == 'tns_modules');
    if (isTnsModule) {
        // the file is part of a module, so we search it in '{ns-app}/node_modules/tns-core-modules/' and '{ns-app}/node_modules/'
        let nsNodeModulesPath: string = path.join(nsProjectPath, 'node_modules');
        let tnsCoreNodeModulesPath: string = path.join(nsNodeModulesPath, 'tns-core-modules');

        let modulePath: string = path.join.apply(path, pathParts.slice(appIndex + 2));
        guesses.push(path.join(tnsCoreNodeModulesPath, modulePath));
        guesses.push(path.join(nsNodeModulesPath, modulePath));
    }
    else {
        guesses.push(path.join(nsProjectPath, resorcePath));
    }

    for (var guessPath of guesses) {
        if (existsSync(guessPath)) {
            return canonicalizeUrl(guessPath);
        }

        let extension: string = path.extname(guessPath);
        let platformSpecificPath: string = guessPath.substr(0, guessPath.length - extension.length) + '.' + additionalFileExtension + extension;
        if (existsSync(platformSpecificPath)) {
            return canonicalizeUrl(platformSpecificPath);
        }
    }

    return null;
}
开发者ID:bundyo,项目名称:nativescript-vscode-extension,代码行数:33,代码来源:utilities.ts


示例3: templatePath

 templatePath (...args: string[]): string {
   let filepath = path.join.apply(path, args)
   if (!path.isAbsolute(filepath)) {
     filepath = path.join(this._rootPath, 'templates', filepath)
   }
   return filepath
 }
开发者ID:YangShaoQun,项目名称:taro,代码行数:7,代码来源:creator.ts


示例4: destinationPath

 destinationPath (...args: string[]): string {
   let filepath = path.join.apply(path, args)
   if (!path.isAbsolute(filepath)) {
     filepath = path.join(this.destinationRoot(), filepath)
   }
   return filepath
 }
开发者ID:YangShaoQun,项目名称:taro,代码行数:7,代码来源:creator.ts


示例5: getOptionsForFixture

export async function getOptionsForFixture(file: string[]) {
	await window.showTextDocument(
		await workspace.openTextDocument(
			path.join.apply(
				this,
				[
					__dirname,
					'..',
					'..',
					'test',
					'fixtures'
				].concat(file)
			)
		)
	);

	assert.ok(window.activeTextEditor);

	let textEditorOptions: TextEditorOptions;
	await new Promise(resolve => {
		window.onDidChangeTextEditorOptions(e => {
			textEditorOptions = e.options;
			resolve();
		});
	});

	assert.ok(textEditorOptions);

	return textEditorOptions;
}
开发者ID:YOTOV-LIMITED,项目名称:editorconfig-vscode,代码行数:30,代码来源:testUtils.ts


示例6: before

 before(async function() {
   this.timeout(BUILD_TIMEOUT_MS);
   // converts a/b/c to a/b/c on Unix and a\b\c on Windows
   const sysDepPath = path.join.apply(null, config.tag.split('/'));
   const dir = path.join(ROOT, sysDepPath);
   await buildDocker(dir, config.tag);
   container = await runDocker(config.tag, PORT);
 });
开发者ID:GoogleCloudPlatform,项目名称:nodejs-docker,代码行数:8,代码来源:test.ts


示例7: root

function root () {
  // We are in /helpers/utils.js
  const paths = [ __dirname, '..', '..' ]

  // We are under /dist directory
  if (process.mainModule.filename.endsWith('.ts') === false) {
    paths.push('..')
  }

  return join.apply(null, paths)
}
开发者ID:jiang263,项目名称:PeerTube,代码行数:11,代码来源:core-utils.ts


示例8: getFixturePath

export function getFixturePath(file: string[]) {
	return path.join.apply(
		this,
		[
			__dirname,
			'..',
			'..',
			'test',
			'fixtures'
		].concat(file)
	);
}
开发者ID:Bigous,项目名称:editorconfig-vscode,代码行数:12,代码来源:testUtils.ts


示例9: mkdirpSync

function mkdirpSync(dirpath) {
    var parts = dirpath.split(path.sep);
    for( var i = 1; i <= parts.length; i++ ) {
        try {
            fs.mkdirSync( path.join.apply(null, parts.slice(0, i)) );
        } catch (error) {
            if (error.code != 'EEXIST'){
                throw error;
            }
        }
    }
}
开发者ID:red-eco,项目名称:VScode-extension,代码行数:12,代码来源:extension.ts


示例10: realpathSync

 public realpathSync(p: string, cache: {[path: string]: string}): string {
   if (this.supportsLinks()) {
     // The path could contain symlinks. Split up the path,
     // resolve any symlinks, return the resolved string.
     const splitPath = p.split(path.sep);
     // TODO: Simpler to just pass through file, find sep and such.
     for (let i = 0; i < splitPath.length; i++) {
       const addPaths = splitPath.slice(0, i + 1);
       splitPath[i] = path.join.apply(path, addPaths);
     }
     return splitPath.join(path.sep);
   } else {
     // No symlinks. We just need to verify that it exists.
     if (this.existsSync(p)) {
       return p;
     } else {
       throw ApiError.ENOENT(p);
     }
   }
 }
开发者ID:diegolameira,项目名称:codesandbox-client,代码行数:20,代码来源:file_system.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript path.posix类代码示例发布时间:2022-05-25
下一篇:
TypeScript path-exists.sync函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap