[feat] disable symlink settings non Windows OS

This commit is contained in:
silentrald
2024-12-11 22:57:13 +08:00
parent 65fb281a64
commit c4e742c201
7 changed files with 138 additions and 103 deletions
+12 -7
View File
@@ -21,19 +21,24 @@ export class FolderLinkerService {
private readonly installLocationService = InstallationLocationService.getInstance();
private readonly staticConfig: StaticConfigurationService;
private linkingType: "junction" | "symlink" = "junction";
// Only Windows support "junction", this is disregarded in other os'es
private linkingType: "junction" | "symlink" =
process.platform === "win32" ? "junction" : "symlink";
private constructor() {
this.installLocationService = InstallationLocationService.getInstance();
this.staticConfig = StaticConfigurationService.getInstance();
this.linkingType = this.staticConfig.get("use-symlinks") === true ? "symlink" : "junction";
log.info(`Linking type is set to ${this.linkingType}`);
if (process.platform === "win32") {
// Only Windows support "junction", this is disregarded in other os'es
this.linkingType = this.staticConfig.get("use-symlinks") === true ? "symlink" : "junction";
log.info(`Linking type is set to ${this.linkingType}`);
this.staticConfig.$watch("use-symlinks").subscribe((useSymlink) => {
this.linkingType = useSymlink === true ? "symlink" : "junction";
log.info(`Linking type set to ${this.linkingType}`);
});
this.staticConfig.$watch("use-symlinks").subscribe((useSymlink) => {
this.linkingType = useSymlink === true ? "symlink" : "junction";
log.info(`Linking type set to ${this.linkingType}`);
});
}
}
private async sharedFolder(): Promise<string> {