force some files to be read-only (#453)

This commit is contained in:
Alberto Iannaccone 2021-07-23 10:01:42 +02:00 committed by GitHub
parent 5897f379a4
commit 38d372e2d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));