mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
[WIP] home dir
This commit is contained in:
parent
c7fd72f2b8
commit
12cdda17f0
@ -11,12 +11,17 @@ namespace ts.server {
|
||||
|
||||
interface NodeChildProcess {
|
||||
send(message: any, sendHandle?: any): void;
|
||||
on(message: "message", f: (m: any) => void): void;
|
||||
}
|
||||
|
||||
const childProcess: {
|
||||
fork(modulePath: string): NodeChildProcess;
|
||||
} = require("child_process");
|
||||
|
||||
const os: {
|
||||
homedir(): string
|
||||
} = require("os");
|
||||
|
||||
interface ReadLineOptions {
|
||||
input: NodeJS.ReadableStream;
|
||||
output?: NodeJS.WritableStream;
|
||||
@ -165,15 +170,21 @@ namespace ts.server {
|
||||
private cachePath: string;
|
||||
|
||||
constructor(private readonly logger: server.Logger) {
|
||||
let basePath: string;
|
||||
switch (process.platform) {
|
||||
case "win32":
|
||||
this.cachePath = normalizeSlashes(combinePaths(process.env.LOCALAPPDATA || process.env.APPDATA, "Microsoft/TypeScript"));
|
||||
basePath = process.env.LOCALAPPDATA || process.env.APPDATA || os.homedir();
|
||||
break;
|
||||
case "linux":
|
||||
basePath = os.homedir();
|
||||
break;
|
||||
case "darwin":
|
||||
case "linux":
|
||||
// TODO:
|
||||
basePath = combinePaths(os.homedir(), "/Library/Application Support/")
|
||||
break;
|
||||
}
|
||||
if (basePath) {
|
||||
this.cachePath = combinePaths(normalizeSlashes(basePath), "/Microsoft/TypeScript");
|
||||
}
|
||||
}
|
||||
|
||||
attach(projectService: ProjectService) {
|
||||
@ -183,7 +194,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
this.installer = childProcess.fork(combinePaths(__dirname, "typingsInstaller.js"));
|
||||
(<any>this.installer).on("message", (m: any) => this.handleMessage(m));
|
||||
this.installer.on("message", m => this.handleMessage(m));
|
||||
}
|
||||
|
||||
enqueueInstallTypingsRequest(project: Project, typingOptions: TypingOptions): void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user