mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-13 14:26:37 +00:00
improve check of read-only files (#918)
This commit is contained in:
parent
aba9db6a6b
commit
46a3466bc5
2
arduino-ide-extension/src/browser/utils/constants.ts
Normal file
2
arduino-ide-extension/src/browser/utils/constants.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export const REMOTE_SKETCHBOOK_FOLDER = 'RemoteSketchbook';
|
||||||
|
export const ARDUINO_CLOUD_FOLDER = 'ArduinoCloud';
|
@ -11,12 +11,13 @@ import { FrontendApplicationContribution } from '@theia/core/lib/browser/fronten
|
|||||||
import { Sketch, SketchesService } from '../../common/protocol';
|
import { Sketch, SketchesService } from '../../common/protocol';
|
||||||
import { ConfigService } from './config-service';
|
import { ConfigService } from './config-service';
|
||||||
import { SketchContainer } from './sketches-service';
|
import { SketchContainer } from './sketches-service';
|
||||||
|
import {
|
||||||
|
ARDUINO_CLOUD_FOLDER,
|
||||||
|
REMOTE_SKETCHBOOK_FOLDER,
|
||||||
|
} from '../../browser/utils/constants';
|
||||||
|
|
||||||
const READ_ONLY_FILES = [
|
const READ_ONLY_FILES = ['sketch.json'];
|
||||||
'thingProperties.h',
|
const READ_ONLY_FILES_REMOTE = ['thingProperties.h', 'thingsProperties.h'];
|
||||||
'thingsProperties.h',
|
|
||||||
'sketch.json',
|
|
||||||
];
|
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class SketchesServiceClientImpl
|
export class SketchesServiceClientImpl
|
||||||
@ -178,7 +179,17 @@ export class SketchesServiceClientImpl
|
|||||||
if (toCheck.scheme === 'user-storage') {
|
if (toCheck.scheme === 'user-storage') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (READ_ONLY_FILES.includes(toCheck?.path?.base)) {
|
|
||||||
|
const isCloudSketch = toCheck
|
||||||
|
.toString()
|
||||||
|
.includes(`${REMOTE_SKETCHBOOK_FOLDER}/${ARDUINO_CLOUD_FOLDER}`);
|
||||||
|
|
||||||
|
const filesToCheck = [
|
||||||
|
...READ_ONLY_FILES,
|
||||||
|
...(isCloudSketch ? READ_ONLY_FILES_REMOTE : []),
|
||||||
|
];
|
||||||
|
|
||||||
|
if (filesToCheck.includes(toCheck?.path?.base)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const readOnly = !this.workspaceService
|
const readOnly = !this.workspaceService
|
||||||
|
Loading…
x
Reference in New Issue
Block a user