mirror of
https://github.com/markuryy/shark.git
synced 2025-12-13 12:01:01 +00:00
feat(settings): add button to open app data folder
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
import { clearDeezerCache } from '$lib/library/deezer-database';
|
||||
import { open, confirm, message } from '@tauri-apps/plugin-dialog';
|
||||
import { relaunch } from '@tauri-apps/plugin-process';
|
||||
import { appDataDir } from '@tauri-apps/api/path';
|
||||
import { openPath } from '@tauri-apps/plugin-opener';
|
||||
|
||||
let currentMusicFolder = $state<string | null>(null);
|
||||
let currentPlaylistsFolder = $state<string | null>(null);
|
||||
@@ -122,6 +124,21 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function openAppDataFolder() {
|
||||
try {
|
||||
const dataPath = await appDataDir();
|
||||
console.log('App data path:', dataPath);
|
||||
if (!dataPath) {
|
||||
throw new Error('Could not get app data directory path');
|
||||
}
|
||||
await openPath(dataPath);
|
||||
} catch (error) {
|
||||
console.error('Error opening app data folder:', error);
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
await message('Error opening app data folder: ' + errorMessage, { title: 'Error', kind: 'error' });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div style="padding: 8px;">
|
||||
@@ -339,6 +356,12 @@
|
||||
<small class="help-text">This will delete all cached Deezer favorites data. The next time you visit the Deezer page, it will refetch from the API.</small>
|
||||
<button onclick={clearDeezerDatabase}>Clear Deezer Cache</button>
|
||||
</div>
|
||||
|
||||
<div class="field-row-stacked">
|
||||
<div class="setting-heading">Open App Data Folder</div>
|
||||
<small class="help-text">Opens the application data folder containing SQLite databases and other app data.</small>
|
||||
<button onclick={openAppDataFolder}>Open Folder</button>
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user