Add cross-platform path handling (#89)
Add cross-platform path handling support - Add sanitizePath, joinPath, buildOutputPath utilities - Add operatingSystem to Settings interface - Replace hardcoded Windows paths with dynamic path handling - Support Windows, Linux, and macOS
This commit is contained in:
@@ -9,6 +9,7 @@ export interface Settings {
|
||||
artistSubfolder: boolean;
|
||||
albumSubfolder: boolean;
|
||||
trackNumber: boolean;
|
||||
operatingSystem: "Windows" | "linux/MacOS"
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: Settings = {
|
||||
@@ -20,16 +21,20 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||
artistSubfolder: false,
|
||||
albumSubfolder: false,
|
||||
trackNumber: false,
|
||||
operatingSystem: "Windows"
|
||||
};
|
||||
|
||||
// TODO: add mac/linux defaults
|
||||
const DEFAULT_PATH : string = "C:\\Users\\Public\\Music";
|
||||
|
||||
async function fetchDefaultPath(): Promise<string> {
|
||||
try {
|
||||
const data = await GetDefaults();
|
||||
return data.downloadPath || "C:\\Users\\Public\\Music";
|
||||
return data.downloadPath || DEFAULT_PATH;
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch default path:", error);
|
||||
}
|
||||
return "C:\\Users\\Public\\Music";
|
||||
return DEFAULT_PATH;
|
||||
}
|
||||
|
||||
const SETTINGS_KEY = "spotiflac-settings";
|
||||
|
||||
Reference in New Issue
Block a user