• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript osenv.home函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: loadNotebook

 loadNotebook(): Notebook {
     let existingNotes: Notebook = null;
     let savedNoteData: string = null;
     switch (this._noteStorageType) {
         case NoteStorageType.LocalStorage:
             savedNoteData = localStorage.getItem(savedNotesLocalStorageKey);
             break;
         case NoteStorageType.FileStorage:
             var fs = require("fs");
             var osenv = require("osenv");
             let noteDirectoryOnDisk = osenv.home() + "/.firenote/";
             let notebookDataFile = noteDirectoryOnDisk + savedNotesLocalStorageKey;
             if (!fs.existsSync(noteDirectoryOnDisk)) {
                 fs.mkdirSync(noteDirectoryOnDisk);
             }
             if (fs.existsSync(notebookDataFile)) {
                 savedNoteData = fs.readFileSync(notebookDataFile, "utf8");
             }
             break;
     }
     if (savedNoteData) {
         //Saved notes exist
         existingNotes = SerializationHelper.toInstance(new Notebook(), savedNoteData);
     }
     else {
         //reset notes and reload notebook
         this.reinitializeNotebook();
         existingNotes = this.loadNotebook();
     }
     return existingNotes;
 }
开发者ID:0xFireball,项目名称:FireNote,代码行数:31,代码来源:storagemanager.ts


示例2: refreshApplication

	public async refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): Promise<void> {
		if (this.device.isEmulator) {
			const simulatorLogFilePath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${this.device.deviceInfo.identifier}/data/Library/Logs/system.log`);
			const simulatorLogFileContent = this.$fs.readText(simulatorLogFilePath) || "";

			const simulatorCachePath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${this.device.deviceInfo.identifier}/data/Containers/Data/Application/`);
			const regex = new RegExp(`^(?:.*?)${deviceAppData.appIdentifier}(?:.*?)${simulatorCachePath}(.*?)$`, "gm");

			let guid = "";
			while (true) {
				const parsed = regex.exec(simulatorLogFileContent);
				if (!parsed) {
					break;
				}

				guid = parsed[1];
			}

			if (!guid) {
				this.$errors.failWithoutHelp(`Unable to find application GUID for application ${deviceAppData.appIdentifier}. Make sure application is installed on Simulator.`);
			}

			const sourcePath = await deviceAppData.getDeviceProjectRootPath();
			const destinationPath = path.join(simulatorCachePath, guid, constants.LiveSyncConstants.IOS_PROJECT_PATH);

			this.$logger.trace(`Transferring from ${sourcePath} to ${destinationPath}`);
			shell.cp("-Rf", path.join(sourcePath, "*"), destinationPath);

			await this.device.applicationManager.restartApplication({ appId: deviceAppData.appIdentifier, projectName: "" });
		} else {
			await this.device.fileSystem.deleteFile("/Documents/AppBuilder/ServerInfo.plist", deviceAppData.appIdentifier);
			const notification = this.$project.projectData.Framework === constants.TARGET_FRAMEWORK_IDENTIFIERS.NativeScript ? "com.telerik.app.refreshApp" : "com.telerik.app.refreshWebView";
			const notificationData = {
				deviceId: this.device.deviceInfo.identifier,
				notificationName: notification,
				commandType: constants.IOS_POST_NOTIFICATION_COMMAND_TYPE
			};
			await this.$iosDeviceOperations.postNotification([notificationData]);
		}
	}
开发者ID:telerik,项目名称:mobile-cli-lib,代码行数:40,代码来源:ios-livesync-service.ts


示例3: constructor

	constructor($errors: IErrors,
		$staticConfig: IStaticConfig,
		$hostInfo: IHostInfo) {
		super({
			ipa: { type: OptionType.String },
			frameworkPath: { type: OptionType.String },
			frameworkName: { type: OptionType.String },
			framework: { type: OptionType.String },
			frameworkVersion: { type: OptionType.String },
			copyFrom: { type: OptionType.String },
			linkTo: { type: OptionType.String  },
			symlink: { type: OptionType.Boolean },
			forDevice: { type: OptionType.Boolean },
			client: { type: OptionType.Boolean, default: true},
			production: { type: OptionType.Boolean },
			debugTransport: {type: OptionType.Boolean},
			keyStorePath: { type: OptionType.String },
			keyStorePassword: { type: OptionType.String,},
			keyStoreAlias: { type: OptionType.String },
			keyStoreAliasPassword: { type: OptionType.String },
			ignoreScripts: {type: OptionType.Boolean },
			tnsModulesVersion: { type: OptionType.String },
			compileSdk: {type: OptionType.Number },
			port: { type: OptionType.Number },
			copyTo: { type: OptionType.String },
			baseConfig: { type: OptionType.String },
			platformTemplate: { type: OptionType.String },
			ng: {type: OptionType.Boolean },
			tsc: {type: OptionType.Boolean },
			bundle: {type: OptionType.Boolean },
			all: {type: OptionType.Boolean },
			teamId: { type: OptionType.String }
		},
		path.join($hostInfo.isWindows ? process.env.AppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
			$errors, $staticConfig);

		// On Windows we moved settings from LocalAppData to AppData. Move the existing file to keep the existing settings
		// I guess we can remove this code after some grace period, say after 1.7 is out
		if ($hostInfo.isWindows) {
			try {
				let shelljs = require("shelljs"),
					oldSettings = path.join(process.env.LocalAppData, ".nativescript-cli", "user-settings.json"),
					newSettings = path.join(process.env.AppData, ".nativescript-cli", "user-settings.json");
				if (shelljs.test("-e", oldSettings) && !shelljs.test("-e", newSettings)) {
					shelljs.mkdir(path.join(process.env.AppData, ".nativescript-cli"));
					shelljs.mv(oldSettings, newSettings);
				}
			} catch (err) {
				// ignore the error - it is too early to use $logger here
			}
		}
	}
开发者ID:JELaVallee,项目名称:nativescript-cli,代码行数:52,代码来源:options.ts


示例4: return

		return (() => {
			if (this.device.isEmulator) {
				let simulatorLogFilePath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${this.device.deviceInfo.identifier}/data/Library/Logs/system.log`);
				let simulatorLogFileContent = this.$fs.readText(simulatorLogFilePath).wait() || "";

				let simulatorCachePath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${this.device.deviceInfo.identifier}/data/Containers/Data/Application/`);
				let regex = new RegExp(`^(?:.*?)${deviceAppData.appIdentifier}(?:.*?)${simulatorCachePath}(.*?)$`, "gm");

				let guid = "";
				while (true) {
					let parsed = regex.exec(simulatorLogFileContent);
					if (!parsed) {
						break;
					}
					guid = parsed[1];
				}

				if (!guid) {
					this.$errors.failWithoutHelp(`Unable to find application GUID for application ${deviceAppData.appIdentifier}. Make sure application is installed on Simulator.`);
				}

				let sourcePath = deviceAppData.deviceProjectRootPath;
				let destinationPath = path.join(simulatorCachePath, guid, LiveSyncConstants.IOS_PROJECT_PATH);

				this.$logger.trace(`Transferring from ${sourcePath} to ${destinationPath}`);
				shell.cp("-Rf", path.join(sourcePath, "*"), destinationPath);

				let cfBundleExecutable = `${this.$project.projectData.Framework}${this.$project.projectData.FrameworkVersion.split(".").join("")}`;
				this.device.applicationManager.restartApplication(deviceAppData.appIdentifier, cfBundleExecutable).wait();
			} else {
				this.device.fileSystem.deleteFile("/Library/Preferences/ServerInfo.plist", deviceAppData.appIdentifier);
				let notificationProxyClient = this.$injector.resolve(iOSProxyServices.NotificationProxyClient, {device: this.device});
				let notification = this.$project.projectData.Framework === this.$projectConstants.TARGET_FRAMEWORK_IDENTIFIERS.NativeScript ? "com.telerik.app.refreshApp" : "com.telerik.app.refreshWebView";
				notificationProxyClient.postNotification(notification);
				notificationProxyClient.closeSocket();
			}

		}).future<void>()();
开发者ID:enchev,项目名称:mobile-cli-lib,代码行数:38,代码来源:ios-livesync-service.ts


示例5: getInstalledApplications

export function getInstalledApplications(deviceId: string): IApplication[] {
	let rootApplicationsPath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${deviceId}/data/Containers/Bundle/Application`);
	if (!fs.existsSync(rootApplicationsPath)) {
		rootApplicationsPath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${deviceId}/data/Applications`);
	}
	let applicationGuids = fs.readdirSync(rootApplicationsPath);
	let result: IApplication[] = [];
	_.each(applicationGuids, applicationGuid => {
		let fullApplicationPath = path.join(rootApplicationsPath, applicationGuid);
		if (fs.statSync(fullApplicationPath).isDirectory()) {
			let applicationDirContents = fs.readdirSync(fullApplicationPath);
			let applicationName = _.find(applicationDirContents, fileName => path.extname(fileName) === ".app");
			let plistFilePath = path.join(fullApplicationPath, applicationName, "Info.plist");
			result.push({
				guid: applicationGuid,
				appIdentifier: getBundleIdentifier(plistFilePath),
				path: path.join(fullApplicationPath, applicationName)
			});
		}
	});

	return result;
}
开发者ID:telerik,项目名称:ios-sim-portable,代码行数:23,代码来源:iphone-simulator-common.ts


示例6: saveNotebook

 saveNotebook(notebookToSave: Notebook) {
     let serializedNotebook: string = SerializationHelper.serialize(notebookToSave);
     switch (this._noteStorageType) {
         case NoteStorageType.LocalStorage:
             localStorage.setItem(savedNotesLocalStorageKey, serializedNotebook);
             break;
         case NoteStorageType.FileStorage:
             var fs = require("fs");
             var osenv = require("osenv");
             let noteDirectoryOnDisk = osenv.home() + "/.firenote/";
             let notebookDataFile = noteDirectoryOnDisk + savedNotesLocalStorageKey;
             if (!fs.existsSync(noteDirectoryOnDisk)) {
                 fs.mkdirSync(noteDirectoryOnDisk);
             }
             fs.writeFileSync(notebookDataFile, serializedNotebook); //asynchronously write file
             break;
     }
 }
开发者ID:0xFireball,项目名称:FireNote,代码行数:18,代码来源:storagemanager.ts


示例7: path

 public static path(): string {
     return `${osenv.home()}/.chullorc`;
 }
开发者ID:victorjacobs,项目名称:chullo-client,代码行数:3,代码来源:configuration.ts


示例8: load

import * as fs from 'fs';
import * as path from 'path';
import { home } from 'osenv';
import { read, getGalleryAPI } from './util';
import { validatePublisher } from './validation';
import * as denodeify from 'denodeify';

const readFile = denodeify<string, string, string>(fs.readFile);
const writeFile = denodeify<string, string, void>(fs.writeFile);
const storePath = path.join(home(), '.vsce');

export interface IPublisher {
	name: string;
	pat: string;
}

export interface IStore {
	publishers: IPublisher[];
}

export interface IGetOptions {
	promptToOverwrite?: boolean;
	promptIfMissing?: boolean;
}

function load(): Promise<IStore> {
	return readFile(storePath, 'utf8')
		.catch<string>(err => err.code !== 'ENOENT' ? Promise.reject(err) : Promise.resolve('{}'))
		.then<IStore>(rawStore => {
			try {
				return Promise.resolve(JSON.parse(rawStore));
开发者ID:rlugojr,项目名称:vscode-vsce,代码行数:31,代码来源:store.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript out.createTargets函数代码示例发布时间:2022-05-25
下一篇:
TypeScript os-locale.sync函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap