當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript path.join類代碼示例

本文整理匯總了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;未經允許,請勿轉載。