Skip to content

Commit af7620e

Browse files
committed
Support VSCode Insiders
1 parent 862e71f commit af7620e

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "code-sync",
33
"displayName": "CodeSync",
44
"description": "Sync VSCode extensions using your favorite file synchronization service (OneDrive, Dropbox, Google Drive, etc.)",
5-
"version": "2.4.0",
5+
"version": "2.5.0",
66
"publisher": "golf1052",
77
"keywords": [
88
"sync",

src/cs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const KEYBINDINGS = 'keybindings.json';
1818
export const SNIPPETS = 'snippets';
1919
export const LOCAL_SETTINGS = 'local-settings.json';
2020

21-
export const currentVersion: string = '2.4.0';
21+
export const currentVersion: string = '2.5.0';
2222
export let vsCodeExtensionDir: string = helpers.getExtensionDir();
2323
export let codeSyncExtensionDir: string = path.join(vsCodeExtensionDir, 'golf1052.code-sync-' + currentVersion);
2424

src/helpers.ts

+24-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ let windows: boolean = process.platform == 'win32';
2121
let osx: boolean = process.platform == 'darwin';
2222
let 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+
2429
export 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

4150
function 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

138151
function 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

Comments
 (0)