File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
import * as path from 'path' ;
2
+ import * as os from 'os' ;
3
+ import * as crypto from 'crypto' ;
2
4
import * as extProtocol from './ExtensionProtocol' ;
3
5
let ipc = require ( 'node-ipc' ) ;
4
6
@@ -22,6 +24,11 @@ export class ExtensionClient {
22
24
return this . _appRoot ;
23
25
}
24
26
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
+
25
32
public static setAppRoot ( appRoot : string ) {
26
33
this . _appRoot = appRoot ;
27
34
}
@@ -40,7 +47,7 @@ export class ExtensionClient {
40
47
this . _ipcClientInitialized = new Promise ( ( res , rej ) => {
41
48
ipc . connectTo (
42
49
'extHost' ,
43
- path . join ( ExtensionClient . getAppRoot ( ) , 'temp-nativescript-vscode-extension-pipe-handle' ) ,
50
+ ExtensionClient . getTempFilePathForDirectory ( ExtensionClient . getAppRoot ( ) ) ,
44
51
( ) => {
45
52
ipc . of . extHost . on ( 'connect' , ( ) => {
46
53
res ( ) ;
Original file line number Diff line number Diff line change 1
1
import * as path from 'path' ;
2
+ import * as os from 'os' ;
3
+ import * as crypto from 'crypto' ;
2
4
import * as fs from 'fs' ;
3
5
import * as vscode from 'vscode' ;
4
6
import * as extProtocol from './ExtensionProtocol' ;
@@ -17,13 +19,18 @@ export class ExtensionServer {
17
19
return this . _instance ;
18
20
}
19
21
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
+
20
27
constructor ( ) {
21
28
this . _isRunning = false ;
22
29
}
23
30
24
31
public getPipeHandlePath ( ) : string {
25
32
return vscode . workspace . rootPath ?
26
- path . join ( vscode . workspace . rootPath , 'temp-nativescript-vscode-extension-pipe-handle' ) :
33
+ ExtensionServer . getTempFilePathForDirectory ( vscode . workspace . rootPath ) :
27
34
null ;
28
35
}
29
36
You can’t perform that action at this time.
0 commit comments