Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 180b0fa

Browse files
author
Alberto Iannaccone
committed
improve check of read-only files
1 parent c430cf0 commit 180b0fa

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const REMOTE_SKETCHBOOK_FOLDER = 'RemoteSketchbook';
2+
export const ARDUINO_CLOUD_FOLDER = 'ArduinoCloud';

‎arduino-ide-extension/src/common/protocol/sketches-service-client-impl.ts‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ import { FrontendApplicationContribution } from '@theia/core/lib/browser/fronten
1111
import { Sketch, SketchesService } from '../../common/protocol';
1212
import { ConfigService } from './config-service';
1313
import { SketchContainer } from './sketches-service';
14+
import {
15+
ARDUINO_CLOUD_FOLDER,
16+
REMOTE_SKETCHBOOK_FOLDER,
17+
} from '../../browser/utils/constants';
1418

15-
const READ_ONLY_FILES = [
16-
'thingProperties.h',
17-
'thingsProperties.h',
18-
'sketch.json',
19-
];
19+
const READ_ONLY_FILES = ['sketch.json'];
20+
const READ_ONLY_FILES_REMOTE = ['thingProperties.h', 'thingsProperties.h'];
2021

2122
@injectable()
2223
export class SketchesServiceClientImpl
@@ -178,7 +179,17 @@ export class SketchesServiceClientImpl
178179
if (toCheck.scheme === 'user-storage') {
179180
return false;
180181
}
181-
if (READ_ONLY_FILES.includes(toCheck?.path?.base)) {
182+
183+
const isCloudSketch = toCheck
184+
.toString()
185+
.includes(`${REMOTE_SKETCHBOOK_FOLDER}/${ARDUINO_CLOUD_FOLDER}`);
186+
187+
const filesToCheck = [
188+
...READ_ONLY_FILES,
189+
...(isCloudSketch ? READ_ONLY_FILES_REMOTE : []),
190+
];
191+
192+
if (filesToCheck.includes(toCheck?.path?.base)) {
182193
return true;
183194
}
184195
const readOnly = !this.workspaceService

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /