mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Merge pull request #273 from Zagrios/bugfix/invalid-path-separator-maps-folders-linux/272
[bugfix-272] fix wrong folder separator for maps
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { contextBridge, ipcRenderer, IpcRendererEvent } from "electron";
|
||||
import { ProviderPlatform } from "shared/models/provider-platform.enum";
|
||||
|
||||
const sep = process.platform === ProviderPlatform.WINDOWS ? "\\" : "/";
|
||||
|
||||
contextBridge.exposeInMainWorld("electron", {
|
||||
ipcRenderer: {
|
||||
@@ -18,4 +21,10 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
ipcRenderer.removeAllListeners(channel);
|
||||
},
|
||||
},
|
||||
path: {
|
||||
sep,
|
||||
join: (...args: string[]): string => {
|
||||
return args.join(sep);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ const FolderItem = ({ version, relativeFolder, onDelete }: FolderProps) => {
|
||||
|
||||
const t = useTranslation();
|
||||
|
||||
const name = relativeFolder.split("\\").at(-1);
|
||||
const name = relativeFolder.split(window.electron.path.sep).at(-1);
|
||||
const color = useThemeColor("first-color");
|
||||
|
||||
const variants: Variants = {
|
||||
|
||||
@@ -5,7 +5,11 @@ export const defaultConfiguration: { [key in DefaultConfigKey]: any } = {
|
||||
language: window.navigator.language.length <= 2 ? `${window.navigator.language}-${window.navigator.language.toLocaleUpperCase()}` : window.navigator.language,
|
||||
supported_languages: ["en-US", "en-EN", "fr-FR", "es-ES", "de-DE"],
|
||||
default_mods: ["SongCore", "WhyIsThereNoLeaderboard", "BeatSaverDownloader", "BeatSaverVoting", "PlaylistManager"],
|
||||
"default-shared-folders": ["Beat Saber_Data\\CustomLevels", "Beat Saber_Data\\CustomWIPLevels", "DLC"],
|
||||
"default-shared-folders": [
|
||||
window.electron.path.join("Beat Saber_Data", "CustomLevels"),
|
||||
window.electron.path.join("Beat Saber_Data", "CustomWIPLevels"),
|
||||
"DLC"
|
||||
],
|
||||
};
|
||||
|
||||
export type DefaultConfigKey = "first-color" | "second-color" | "theme" | "language" | "supported_languages" | "default_mods" | "default-shared-folders";
|
||||
|
||||
Vendored
+4
@@ -7,6 +7,10 @@ declare global {
|
||||
once(channel: string, func: (...args: any) => void): void;
|
||||
removeAllListeners(channel: string): void;
|
||||
};
|
||||
path: {
|
||||
sep: "/"|"\\";
|
||||
join: (...args: string[]) => string;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class MapsManagerService {
|
||||
}
|
||||
|
||||
public static readonly REMEMBER_CHOICE_DELETE_MAP_KEY = "not-confirm-delete-map";
|
||||
public static readonly RELATIVE_MAPS_FOLDER = "Beat Saber_Data\\CustomLevels";
|
||||
public static readonly RELATIVE_MAPS_FOLDER = window.electron.path.join("Beat Saber_Data", "CustomLevels");
|
||||
|
||||
private readonly ipcService: IpcService;
|
||||
private readonly modal: ModalService;
|
||||
|
||||
@@ -35,7 +35,7 @@ export class VersionFolderLinkerService {
|
||||
let progressOpened = false;
|
||||
|
||||
if (!this.progress.isVisible) {
|
||||
this.progress.showFake(0.01, null, action.relativeFolder.split("\\").at(-1));
|
||||
this.progress.showFake(0.01, null, action.relativeFolder.split(window.electron.path.sep).at(-1));
|
||||
progressOpened = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export enum ProviderPlatform {
|
||||
WINDOWS = "win32",
|
||||
MAC = "darwin",
|
||||
LINUX = "linux"
|
||||
}
|
||||
Reference in New Issue
Block a user