Skip to content

Commit 524fbbd

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
arduino/arduino-pro-ide#336: Fixed 'Save As...'
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
1 parent 7a37aa2 commit 524fbbd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arduino-ide-extension/src/node/sketches-service-impl.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,11 @@ void loop() {
382382
}
383383
const newName = path.basename(destination);
384384
try {
385-
await fs.rename(path.join(destination, new URI(sketch.mainFileUri).path.base), path.join(destination, `${newName}.ino`));
385+
const oldPath = path.join(destination, new URI(sketch.mainFileUri).path.base);
386+
const newPath = path.join(destination, `${newName}.ino`);
387+
if (oldPath !== newPath) {
388+
await fs.rename(oldPath, newPath);
389+
}
386390
await this.loadSketch(destinationUri); // Sanity check.
387391
resolve();
388392
} catch (e) {

0 commit comments

Comments
 (0)