本文整理汇总了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;
}
示例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;
}
示例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
}
示例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
}
示例5: getDataRelativePath
function getDataRelativePath(...paths: string[]) {
let args = _.toArray(arguments);
args.unshift(getDataPath());
return path.join.apply(this, args);
}
示例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: 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;
}
}
}
}
示例9: getFixturePath
export function getFixturePath(file: string[]) {
return path.join.apply(
this,
[
__dirname,
'..',
'..',
'test',
'fixtures'
].concat(file)
);
}
示例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);
}
}
}