From 38d372e2d5b9fc2d426f5c2ef97a71a70605ce43 Mon Sep 17 00:00:00 2001 From: Alberto Iannaccone Date: Fri, 23 Jul 2021 10:01:42 +0200 Subject: [PATCH] force some files to be read-only (#453) --- .../src/common/protocol/sketches-service-client-impl.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arduino-ide-extension/src/common/protocol/sketches-service-client-impl.ts b/arduino-ide-extension/src/common/protocol/sketches-service-client-impl.ts index 7c785d5d..4188a362 100644 --- a/arduino-ide-extension/src/common/protocol/sketches-service-client-impl.ts +++ b/arduino-ide-extension/src/common/protocol/sketches-service-client-impl.ts @@ -12,6 +12,12 @@ import { Sketch, SketchesService } from '../../common/protocol'; import { ConfigService } from './config-service'; import { SketchContainer } from './sketches-service'; +const READ_ONLY_FILES = [ + 'thingProperties.h', + 'thingsProperties.h', + 'sketch.json', +]; + @injectable() export class SketchesServiceClientImpl implements FrontendApplicationContribution @@ -172,6 +178,9 @@ export class SketchesServiceClientImpl if (toCheck.scheme === 'user-storage') { return false; } + if (READ_ONLY_FILES.includes(toCheck?.path?.base)) { + return true; + } const readOnly = !this.workspaceService .tryGetRoots() .some(({ resource }) => resource.isEqualOrParent(toCheck));