Skip to content

Commit 98f4e5c

Browse files
committed
[Fix] Inner directories of song folder path generation caused crashes - 2
1 parent 96d5bc1 commit 98f4e5c

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
33
"productName": "OpenTaiko Hub",
44
"identifier": "com.opentaiko.hub",
5-
"version": "0.1.10",
5+
"version": "0.1.11",
66
"build": {
77
"beforeBuildCommand": "npm run build",
88
"beforeDevCommand": "npm run dev",

src/lib/pages/SongsTab.svelte

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,17 @@
257257
let localFileName = (filePath.startsWith(songObj.tjaFolderPath + '\\') || filePath.startsWith(songObj.tjaFolderPath + '/')) ?
258258
filePath.slice(songObj.tjaFolderPath.length + 1)
259259
: filePath.split("\\").pop();
260-
let localFileFold = localFileName.replace(/\\[^\\]*$/g);
260+
let localFileFold = localFileName.replace(/(?:^|\\)[^\\]*$/g, '');
261261
262262
const tjaFileUrl = `https://raw.githubusercontent.com/OpenTaiko/OpenTaiko-Soundtrack/main/${filePath}`;
263263
const dlPath = await path.join(chartDownloadFolder, localFileName.replace(/\\/g, '/'));
264-
const dlPathFold = await path.join(chartDownloadFolder, localFileFold.replace(/\\/g, '/'));
265264
266-
let inner_fold_exists = await exists(dlPathFold);
267-
if (!inner_fold_exists)
268-
await mkdir(dlPathFold, {recursive: true});
265+
if (localFileFold) {
266+
const dlPathFold = await path.join(chartDownloadFolder, localFileFold.replace(/\\/g, '/'));
267+
let inner_fold_exists = await exists(dlPathFold);
268+
if (!inner_fold_exists)
269+
await mkdir(dlPathFold, {recursive: true});
270+
}
269271
270272
const success = await backoffDownload(
271273
tjaFileUrl,

0 commit comments

Comments
 (0)