Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit f87ceb7

Browse files
authored
fix package folder location
2 parents 4b896f6 + c845266 commit f87ceb7

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/arduino/arduinoSettings.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,26 @@ export class ArduinoSettings implements IArduinoSettings {
4848
this._commandPath = "arduino_debug.exe";
4949
}
5050
} else if (platform === "linux") {
51-
this._packagePath = path.join(process.env.HOME, ".arduino15");
51+
if (util.directoryExistsSync(path.join(this._arduinoPath, "portable"))) {
52+
this._packagePath = path.join(this._arduinoPath, "portable");
53+
} else {
54+
this._packagePath = path.join(process.env.HOME, ".arduino15");
55+
}
5256
this._sketchbookPath = this.preferences.get("sketchbook.path") || path.join(process.env.HOME, "Arduino");
5357
if (this._commandPath === "") {
5458
this._commandPath = "arduino";
5559
}
5660
} else if (platform === "darwin") {
57-
this._packagePath = path.join(process.env.HOME, "Library/Arduino15");
61+
if (util.directoryExistsSync(path.join(this._arduinoPath, "portable"))) {
62+
this._packagePath = path.join(this._arduinoPath, "portable");
63+
} else {
64+
this._packagePath = path.join(process.env.HOME, "Library/Arduino15");
65+
}
5866
this._sketchbookPath = this.preferences.get("sketchbook.path") || path.join(process.env.HOME, "Documents/Arduino");
5967
if (this._commandPath === "") {
6068
this._commandPath = "/Contents/MacOS/Arduino";
6169
}
6270
}
63-
64-
// Arduino IDE will save all packages into portable folder if it exsits.
65-
// https://github.com/Microsoft/vscode-arduino/issues/415
66-
if (!util.directoryExistsSync(this._packagePath) && util.directoryExistsSync(path.join(this._arduinoPath, "portable"))) {
67-
this._packagePath = path.join(this._arduinoPath, "portable");
68-
}
6971
}
7072

7173
public get arduinoPath(): string {
@@ -150,7 +152,9 @@ export class ArduinoSettings implements IArduinoSettings {
150152
folder = folder.replace(/%([^%]+)%/g, (match, p1) => {
151153
return process.env[p1];
152154
});
153-
if (util.fileExistsSync(path.join(this._arduinoPath, "AppxManifest.xml"))) {
155+
if (util.directoryExistsSync(path.join(this._arduinoPath, "portable"))) {
156+
this._packagePath = path.join(this._arduinoPath, "portable");
157+
} else if (util.fileExistsSync(path.join(this._arduinoPath, "AppxManifest.xml"))) {
154158
this._packagePath = path.join(folder, "ArduinoData");
155159
} else {
156160
this._packagePath = path.join(process.env.LOCALAPPDATA, "Arduino15");

0 commit comments

Comments
 (0)