本文整理匯總了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);
}
示例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;
}
示例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
}
示例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
}
示例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;
}
示例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);
});
示例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)
}
示例8: getFixturePath
export function getFixturePath(file: string[]) {
return path.join.apply(
this,
[
__dirname,
'..',
'..',
'test',
'fixtures'
].concat(file)
);
}
示例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;
}
}
}
}
示例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);
}
}
}