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 c0c257e

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

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-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: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ 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 * as path from 'path';
15+
import {
16+
ARDUINO_CLOUD_FOLDER,
17+
REMOTE_SKETCHBOOK_FOLDER,
18+
} from '../../browser/utils/constants';
1419

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

2123
@injectable()
2224
export class SketchesServiceClientImpl
@@ -178,7 +180,17 @@ export class SketchesServiceClientImpl
178180
if (toCheck.scheme === 'user-storage') {
179181
return false;
180182
}
181-
if (READ_ONLY_FILES.includes(toCheck?.path?.base)) {
183+
184+
const isCloudSketch = toCheck
185+
.toString()
186+
.includes(path.join(REMOTE_SKETCHBOOK_FOLDER, ARDUINO_CLOUD_FOLDER));
187+
188+
const filesToCheck = [
189+
...READ_ONLY_FILES,
190+
...(isCloudSketch ? READ_ONLY_FILES_REMOTE : []),
191+
];
192+
193+
if (filesToCheck.includes(toCheck?.path?.base)) {
182194
return true;
183195
}
184196
const readOnly = !this.workspaceService

0 commit comments

Comments
(0)

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