本文整理汇总了TypeScript中path.win32类的典型用法代码示例。如果您正苦于以下问题:TypeScript win32类的具体用法?TypeScript win32怎么用?TypeScript win32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了win32类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: urlFromPath
export default function urlFromPath(root, filepath) {
if (!filepath.startsWith(root)) {
throw new Error(`file path is not in root: ${filepath} (${root})`);
}
// On windows systems, convert filesystem path to URL by replacing slashes
let isPlatformWin = /^win/.test(process.platform);
let isExtendedLengthPath = /^\\\\\?\\/.test(filepath);
let hasNonAscii = /[^\x00-\x80]+/.test(filepath);
if (isPlatformWin && !isExtendedLengthPath && !hasNonAscii) {
return path.win32.relative(root, filepath).replace(/\\/g, '/');
}
// Otherwise, just return the relative path between the two
return path.relative(root, filepath);
}
开发者ID:chrisUsick,项目名称:polymer-cli,代码行数:16,代码来源:url-from-path.ts
示例2: parseCliArgs
export function parseCliArgs(argv: string[]): CliArgTypes {
// remove optional unix node call
if (path.basename(argv[0] || '') === 'node') {
argv.splice(0, 1)
}
// remove optional windows node call
if (path.win32.basename(argv[0] || '') === 'node.exe') {
argv.splice(0, 1)
}
// remove optional linux text-run call
if (path.basename(argv[0] || '') === 'text-run') {
argv.splice(0, 1)
}
// remove optional Windows CLI call
if (argv[0] && argv[0].endsWith('dist\\cli\\cli.js')) {
argv.splice(0, 1)
}
const result = minimist(argv, { boolean: 'offline' })
const commands = result._ || []
delete result._
// extract command
let command = ''
if (availableCommands().includes(commands[0])) {
command = commands[0]
commands.splice(0, 1)
} else {
command = 'run'
}
result.command = command
result.files = commands[0]
return result
}
开发者ID:Originate,项目名称:tutorial-runner,代码行数:38,代码来源:parse-cli-args.ts
示例3: toVmFile
toVmFile(file: string): string {
return path.win32.join("Z:", file)
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:3,代码来源:WineVm.ts
示例4:
ext: ".txt",
name: "file"
});
// returns
// '/home/user/dir/file.txt'
path.posix.format({
dir: "/home/user/dir",
base: "file.txt"
});
// returns
// '/home/user/dir/file.txt'
path.win32.format({
root: "C:\\",
dir: "C:\\home\\user\\dir",
ext: ".txt",
name: "file"
});
// returns
// 'C:\home\user\dir\file.txt'
path.win32.format({
dir: "C:\\home\\user\\dir",
base: "file.txt"
});
// returns
// 'C:\home\user\dir\file.txt'
}
////////////////////////////////////////////////////
/// readline tests : https://nodejs.org/api/readline.html
开发者ID:Dru89,项目名称:DefinitelyTyped,代码行数:32,代码来源:node-tests.ts
示例5: spyOn
spyOn(path, 'join').and.callFake((...args: string[]) => { return path.win32.join(...args); });
开发者ID:marclaval,项目名称:angular,代码行数:1,代码来源:reflector_host_spec.ts
示例6: shouldMapPaths
private shouldMapPaths(remotePath: string): boolean {
// Map paths only if localRoot/remoteRoot are set, and the remote path is absolute on some system
return !!this._localRoot && !!this._remoteRoot && (path.posix.isAbsolute(remotePath) || path.win32.isAbsolute(remotePath) || utils.isFileUrl(remotePath));
}
开发者ID:Microsoft,项目名称:vscode-chrome-debug-core,代码行数:4,代码来源:remotePathTransformer.ts
示例7: join
/**
* Cross-platform path.join
*/
function join(a: string, b: string): string {
return a.match(/^[A-Za-z]:/) ?
path.win32.join(a, b) :
utils.forceForwardSlashes(path.posix.join(a, b));
}
开发者ID:Microsoft,项目名称:vscode-chrome-debug-core,代码行数:8,代码来源:remotePathTransformer.ts
示例8: relative
/**
* Cross-platform path.relative
*/
function relative(a: string, b: string): string {
return a.match(/^[A-Za-z]:/) ?
path.win32.relative(a, b) :
path.posix.relative(a, b);
}
开发者ID:Microsoft,项目名称:vscode-chrome-debug-core,代码行数:8,代码来源:remotePathTransformer.ts
注:本文中的path.win32类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论