@@ -21,6 +21,11 @@ let windows: boolean = process.platform == 'win32';
2121let osx : boolean = process . platform == 'darwin' ;
2222let linux : boolean = process . platform == 'linux' ;
2323
24+ export function isInsiders ( ) : boolean {
25+ // I have no idea if this works for non english :|
26+ return vscode . env . appName . toLowerCase ( ) . includes ( "insider" ) ;
27+ }
28+
2429export function getInstalledExtensions ( ) : vscode . Extension < any > [ ] {
2530 return vscode . extensions . all . filter ( e => {
2631 return e . extensionPath . startsWith ( os . homedir ( ) ) ;
@@ -34,19 +39,27 @@ export function getExtensionDir(): string {
3439 return p . dir ;
3540 }
3641 else {
37- return path . join ( os . homedir ( ) , '.vscode/extensions' ) ;
42+ let extensionsPath : string = '.vscode/extensions' ;
43+ if ( isInsiders ( ) ) {
44+ extensionsPath = '.vscode-insiders/extensions' ;
45+ }
46+ return path . join ( os . homedir ( ) , extensionsPath ) ;
3847 }
3948}
4049
4150function getCodeSettingsFolderPath ( ) : string {
51+ let codeString = 'Code' ;
52+ if ( isInsiders ( ) ) {
53+ codeString = 'Code - Insiders'
54+ }
4255 if ( windows ) {
43- return path . join ( process . env . APPDATA , 'Code /User/' ) ;
56+ return path . join ( process . env . APPDATA , ` ${ codeString } /User/` ) ;
4457 }
4558 else if ( osx ) {
46- return path . join ( os . homedir ( ) , ' Library/Application Support/Code /User/' ) ;
59+ return path . join ( os . homedir ( ) , ` Library/Application Support/${ codeString } /User/` ) ;
4760 }
4861 else if ( linux ) {
49- return path . join ( os . homedir ( ) , ' .config/Code /User/' ) ;
62+ return path . join ( os . homedir ( ) , ` .config/${ codeString } /User/` ) ;
5063 }
5164 else {
5265 return '' ;
@@ -136,11 +149,16 @@ export function logError(err: Error): void {
136149}
137150
138151function getCodeCommand ( ) : string {
152+ let codeString : string = 'code' ;
153+ if ( isInsiders ( ) ) {
154+ codeString = 'code-insiders' ;
155+ }
156+
139157 if ( windows ) {
140- return 'code .cmd' ;
158+ return ` ${ codeString } .cmd` ;
141159 }
142160 else {
143- return 'code' ;
161+ return codeString ;
144162 }
145163}
146164
0 commit comments