mirror of https://github.com/microsoft/vscode.git
Simplify Linux policy service implementation as requested
Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
This commit is contained in:
parent
6698f710d0
commit
c456efdd8b
|
@ -199,26 +199,16 @@ class CodeMain {
|
|||
// enable atomic read / write operations.
|
||||
fileService.registerProvider(Schemas.vscodeUserData, new FileUserDataProvider(Schemas.file, diskFileSystemProvider, Schemas.vscodeUserData, userDataProfilesMainService, uriIdentityService, logService));
|
||||
|
||||
// Policy service configuration:
|
||||
// - Windows: Uses registry-based policies via NativePolicyService
|
||||
// - macOS: Uses bundle-based policies via NativePolicyService
|
||||
// - Linux: Uses JSON file-based policies by default via FilePolicyService
|
||||
// Policy file location: /etc/{applicationName}/policy.json (system-wide, admin-only writable)
|
||||
// - Other platforms: Can use JSON policies if __enable-file-policy flag is set
|
||||
// Policy
|
||||
let policyService: IPolicyService | undefined;
|
||||
if (isWindows && productService.win32RegValueName) {
|
||||
policyService = disposables.add(new NativePolicyService(logService, productService.win32RegValueName));
|
||||
} else if (isMacintosh && productService.darwinBundleIdentifier) {
|
||||
policyService = disposables.add(new NativePolicyService(logService, productService.darwinBundleIdentifier));
|
||||
} else if (isLinux || environmentMainService.policyFile) {
|
||||
// Support JSON policies by default on Linux from system-wide location
|
||||
const policyFile = environmentMainService.policyFile ||
|
||||
(isLinux ? URI.file(`/etc/${productService.applicationName}/policy.json`) : undefined);
|
||||
if (policyFile) {
|
||||
policyService = disposables.add(new FilePolicyService(policyFile, fileService, logService));
|
||||
} else {
|
||||
policyService = new NullPolicyService();
|
||||
}
|
||||
} else if (isLinux) {
|
||||
policyService = disposables.add(new FilePolicyService(URI.file(`/etc/${productService.applicationName}/policy.json`), fileService, logService));
|
||||
} else if (environmentMainService.policyFile) {
|
||||
policyService = disposables.add(new FilePolicyService(environmentMainService.policyFile, fileService, logService));
|
||||
} else {
|
||||
policyService = new NullPolicyService();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue