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


TypeScript join.apply方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例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: 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

示例9: getFixturePath

export function getFixturePath(file: string[]) {
	return path.join.apply(
		this,
		[
			__dirname,
			'..',
			'..',
			'test',
			'fixtures'
		].concat(file)
	);
}
开发者ID:Bigous,项目名称:editorconfig-vscode,代码行数:12,代码来源:testUtils.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.apply方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。