File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 11import * as path from 'path' ;
2+ import * as os from 'os' ;
3+ import * as crypto from 'crypto' ;
24import * as extProtocol from './ExtensionProtocol' ;
35let ipc = require ( 'node-ipc' ) ;
46
@@ -22,6 +24,11 @@ export class ExtensionClient {
2224 return this . _appRoot ;
2325 }
2426
27+ public static getTempFilePathForDirectory ( directoryPath : string ) {
28+ let fileName : string = 'vsc-ns-ext-' + crypto . createHash ( 'md5' ) . update ( directoryPath ) . digest ( "hex" ) + '.sock' ;
29+ return path . join ( os . tmpdir ( ) , fileName ) ;
30+ }
31+
2532 public static setAppRoot ( appRoot : string ) {
2633 this . _appRoot = appRoot ;
2734 }
@@ -40,7 +47,7 @@ export class ExtensionClient {
4047 this . _ipcClientInitialized = new Promise ( ( res , rej ) => {
4148 ipc . connectTo (
4249 'extHost' ,
43- path . join ( ExtensionClient . getAppRoot ( ) , 'temp-nativescript-vscode-extension-pipe-handle' ) ,
50+ ExtensionClient . getTempFilePathForDirectory ( ExtensionClient . getAppRoot ( ) ) ,
4451 ( ) => {
4552 ipc . of . extHost . on ( 'connect' , ( ) => {
4653 res ( ) ;
Original file line number Diff line number Diff line change 11import * as path from 'path' ;
2+ import * as os from 'os' ;
3+ import * as crypto from 'crypto' ;
24import * as fs from 'fs' ;
35import * as vscode from 'vscode' ;
46import * as extProtocol from './ExtensionProtocol' ;
@@ -17,13 +19,18 @@ export class ExtensionServer {
1719 return this . _instance ;
1820 }
1921
22+ public static getTempFilePathForDirectory ( directoryPath : string ) {
23+ let fileName : string = 'vsc-ns-ext-' + crypto . createHash ( 'md5' ) . update ( directoryPath ) . digest ( "hex" ) + '.sock' ;
24+ return path . join ( os . tmpdir ( ) , fileName ) ;
25+ }
26+
2027 constructor ( ) {
2128 this . _isRunning = false ;
2229 }
2330
2431 public getPipeHandlePath ( ) : string {
2532 return vscode . workspace . rootPath ?
26- path . join ( vscode . workspace . rootPath , 'temp-nativescript-vscode-extension-pipe-handle' ) :
33+ ExtensionServer . getTempFilePathForDirectory ( vscode . workspace . rootPath ) :
2734 null ;
2835 }
2936
You can’t perform that action at this time.
0 commit comments