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


TypeScript os.platform函数代码示例

本文整理汇总了TypeScript中os.platform函数的典型用法代码示例。如果您正苦于以下问题:TypeScript platform函数的具体用法?TypeScript platform怎么用?TypeScript platform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: buildPlaceholderFindCommand

/** Builds the command that will be executed to find all files containing version placeholders. */
function buildPlaceholderFindCommand(packageDir: string) {
  if (platform() === 'win32') {
    return {
      binary: 'findstr',
      args: ['/msi', `${ngVersionPlaceholderText} ${versionPlaceholderText}`, `${packageDir}\\*`]
    };
  } else {
    return {
      binary: 'grep',
      args: ['-ril', `${ngVersionPlaceholderText}\\|${versionPlaceholderText}`, packageDir]
    };
  }
}
开发者ID:GuzmanPI,项目名称:material2,代码行数:14,代码来源:version-placeholders.ts

示例2: _appDirectory

 private _appDirectory(): string {
   var dir;
   switch (os.platform()) {
     case 'win32':
       break;
     case 'darwin':
       dir = '/Applications/Sublime Text 2.app/Contents'
       break;
     default:
       dir = null;
   }
   return dir;
 }
开发者ID:wakatime,项目名称:wakatime-desktop,代码行数:13,代码来源:sublimeText2.ts

示例3: postConstruct

 @postConstruct()
 public postConstruct() {
   this.headers = {
     broadhash : this.appConfig.nethash,
     firewalled: this.appConfig.forging.transactionsPolling ? 'true' : 'false',
     height    : 1,
     nethash   : this.appConfig.nethash,
     nonce     : this.nonce,
     os        : `${os.platform()}${os.release()}`,
     port      : this.appConfig.port,
     version   : this.appConfig.version,
   };
 }
开发者ID:RiseVision,项目名称:rise-node,代码行数:13,代码来源:system.ts

示例4: help

	help(): string {
		const executable = 'code' + (os.platform() === 'win32' ? '.exe' : '');

		return `Visual Studio Code v${ packageJson.version }

Usage: ${ executable } [arguments] [paths...]

Options:
	-h, --help     Print usage.
	--locale       Use a specific locale.
	-n             Force a new instance of Code.
	-v, --version  Print version.`;
	}
开发者ID:ErickWendel,项目名称:vscode,代码行数:13,代码来源:cli.ts

示例5: buildPackageImportStatementFindCommand

/** Builds the command that will be executed to find all import statements for a package. */
function buildPackageImportStatementFindCommand(searchDirectory: string, packageName: string) {
  if (platform() === 'win32') {
    return {
      binary: 'findstr',
      args: ['/r', `from.'@angular-mdc/${packageName}/.*'`, `${searchDirectory}\\*.ts`]
    };
  } else {
    return {
      binary: 'grep',
      args: ['-Eroh', '--include', '*.ts', `from '@angular-mdc/${packageName}/.+';`, searchDirectory]
    };
  }
}
开发者ID:cd8608,项目名称:angular-mdc-web,代码行数:14,代码来源:secondary-entry-points.ts

示例6: debug

	public async debug(debugData: IDebugData, options: IDebugOptions): Promise<IDebugInformation> {
		const device = this.$devicesService.getDeviceByIdentifier(debugData.deviceIdentifier);

		if (!device) {
			this.$errors.failWithoutHelp(`Cannot find device with identifier ${debugData.deviceIdentifier}.`);
		}

		if (device.deviceInfo.status !== CONNECTED_STATUS) {
			this.$errors.failWithoutHelp(`The device with identifier ${debugData.deviceIdentifier} is unreachable. Make sure it is Trusted and try again.`);
		}

		await this.$analyticsService.trackEventActionInGoogleAnalytics({
			action: TrackActionNames.Debug,
			device,
			additionalData: this.$mobileHelper.isiOSPlatform(device.deviceInfo.platform) && options && options.inspector ? DebugTools.Inspector : DebugTools.Chrome,
			projectDir: debugData.projectDir
		});

		if (!(await device.applicationManager.isApplicationInstalled(debugData.applicationIdentifier))) {
			this.$errors.failWithoutHelp(`The application ${debugData.applicationIdentifier} is not installed on device with identifier ${debugData.deviceIdentifier}.`);
		}

		const debugOptions: IDebugOptions = _.cloneDeep(options);

		// TODO: Check if app is running.
		// For now we can only check if app is running on Android.
		// After we find a way to check on iOS we should use it here.
		let result: string;

		const debugService = this.getDebugService(device);
		if (!debugService) {
			this.$errors.failWithoutHelp(`Unsupported device OS: ${device.deviceInfo.platform}. You can debug your applications only on iOS or Android.`);
		}

		// TODO: Consider to move this code to ios-debug-service
		if (this.$mobileHelper.isiOSPlatform(device.deviceInfo.platform)) {
			if (device.isEmulator && !debugData.pathToAppPackage && debugOptions.debugBrk) {
				this.$errors.failWithoutHelp("To debug on iOS simulator you need to provide path to the app package.");
			}

			if (this.$hostInfo.isWindows) {
				debugOptions.emulator = false;
			} else if (!this.$hostInfo.isDarwin) {
				this.$errors.failWithoutHelp(`Debugging on iOS devices is not supported for ${platform()} yet.`);
			}
		}

		result = await debugService.debug(debugData, debugOptions);

		return this.getDebugInformation(result, device.deviceInfo.identifier);
	}
开发者ID:NathanaelA,项目名称:nativescript-cli,代码行数:51,代码来源:debug-service.ts

示例7: GenerateOptionsSchema

export function GenerateOptionsSchema() {
    let packageJSON: any = JSON.parse(fs.readFileSync('package.json').toString());
    let schemaJSON: any = JSON.parse(fs.readFileSync('src/tools/OptionsSchema.json').toString());
    let symbolSettingsJSON: any = JSON.parse(fs.readFileSync('src/tools/VSSymbolSettings.json').toString());
    mergeReferences(schemaJSON.definitions, symbolSettingsJSON.definitions);

    schemaJSON.definitions = ReplaceReferences(schemaJSON.definitions, schemaJSON.definitions);

    // Hard Code adding in configurationAttributes launch and attach.
    // .NET Core
    packageJSON.contributes.debuggers[0].configurationAttributes.launch = schemaJSON.definitions.LaunchOptions;
    packageJSON.contributes.debuggers[0].configurationAttributes.attach = schemaJSON.definitions.AttachOptions;

    // Full .NET Framework
    packageJSON.contributes.debuggers[1].configurationAttributes.launch = schemaJSON.definitions.LaunchOptions;
    packageJSON.contributes.debuggers[1].configurationAttributes.attach = schemaJSON.definitions.AttachOptions;

    // Make a copy of the options for unit test debugging
    let unitTestDebuggingOptions = JSON.parse(JSON.stringify(schemaJSON.definitions.AttachOptions.properties));
    // Remove the options we don't want
    delete unitTestDebuggingOptions.processName;
    delete unitTestDebuggingOptions.processId;
    delete unitTestDebuggingOptions.pipeTransport;
    // Add the additional options we do want
    unitTestDebuggingOptions["type"] = {
        "type": "string",
        "enum": [
            "coreclr",
            "clr"
        ],
        "description": "Type type of code to debug. Can be either 'coreclr' for .NET Core debugging, or 'clr' for Desktop .NET Framework. 'clr' only works on Windows as the Desktop framework is Windows-only.",
        "default": "coreclr"
    };
    unitTestDebuggingOptions["debugServer"] = {
        "type": "number",
        "description": "For debug extension development only: if a port is specified VS Code tries to connect to a debug adapter running in server mode",
        "default": 4711
    };
    packageJSON.contributes.configuration.properties["csharp.unitTestDebuggingOptions"].properties = unitTestDebuggingOptions;

    let content = JSON.stringify(packageJSON, null, 2);
    if (os.platform() === 'win32') {
        content = content.replace(/\n/gm, "\r\n");
    }
    
    // We use '\u200b' (unicode zero-length space character) to break VS Code's URL detection regex for URLs that are examples. This process will
    // convert that from the readable espace sequence, to just an invisible character. Convert it back to the visible espace sequence.
    content = content.replace(/\u200b/gm, "\\u200b");

    fs.writeFileSync('package.json', content);
}
开发者ID:eamodio,项目名称:omnisharp-vscode,代码行数:51,代码来源:GenerateOptionsSchema.ts

示例8: removeUnnecessaryFile

function removeUnnecessaryFile(): Promise<void> {
    if (os.platform() !== 'win32') {
        let sourcePath: string = util.getDebugAdaptersPath("bin/OpenDebugAD7.exe.config");
        if (fs.existsSync(sourcePath)) {
            fs.rename(sourcePath, util.getDebugAdaptersPath("bin/OpenDebugAD7.exe.config.unused"), (err: NodeJS.ErrnoException) => {
                if (err) {
                    getOutputChannelLogger().appendLine(`ERROR: fs.rename failed with "${err.message}". Delete ${sourcePath} manually to enable debugging.`);
                }
            });
        }
    }

    return Promise.resolve();
}
开发者ID:Microsoft,项目名称:vscppsamples,代码行数:14,代码来源:main.ts

示例9:

    }).then(answer => {
        const config: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration('codeFileNav');
        const platform: string = os.platform();
        const rFlag: string = answer === 'Open in a new window' ? '-n' : '-r';
        const folderPath: string = data.cwd.includes(' ') ? `"${data.cwd}"` : data.cwd;
        const platformCodePath: string = config.get(`codePath.${platform}`, 'code');
        const codePath: string = platformCodePath.includes(' ') ? `"${platformCodePath}"` : platformCodePath;

        child_process.exec(`${codePath} ${folderPath} ${rFlag}`, err => {
            if (err) {
                vscode.window.showErrorMessage(`Error: Ensure that your 'codeFileNav.codePath.${platform}' configuration is correct.`)
            }
        });
    });
开发者ID:jakelucas,项目名称:code-file-nav,代码行数:14,代码来源:commands.ts

示例10: connectSocket

function connectSocket(socket: net.Socket): net.Socket {
  let u = discoverUrl();
  if (u.protocol == 'tcp:' && u.port) {
    socket.connect(+u.port, '127.0.0.1');
  } else if (u.protocol == 'local:' && u.hostname && os.platform() == 'win32') {
    let pipePath = '\\\\.\\pipe\\' + u.hostname;
    socket.connect(pipePath);
  } else if (u.protocol == 'local:' && u.path) {
    socket.connect(u.path);
  } else {
    throw 'Unknown protocol ' + u.protocol;
  }
  return socket;
}
开发者ID:xeno-by,项目名称:dotty,代码行数:14,代码来源:sbt-server.ts


注:本文中的os.platform函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。