From 83bc3df504bc60804fa2c28d6999e81148cf3117 Mon Sep 17 00:00:00 2001 From: tillvit Date: Tue, 3 Sep 2024 15:49:12 -0400 Subject: [PATCH] Fix dirname not being used for uploading audio files SMPath uses "/" as delimiter, which breaks on windows --- app/src/data/ChartListWindowData.ts | 3 ++- app/src/data/SMPropertiesData.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/data/ChartListWindowData.ts b/app/src/data/ChartListWindowData.ts index a29d4754..4b327292 100644 --- a/app/src/data/ChartListWindowData.ts +++ b/app/src/data/ChartListWindowData.ts @@ -4,6 +4,7 @@ import { Icons } from "../gui/Icons" import { DirectoryWindow } from "../gui/window/DirectoryWindow" import { ActionHistory } from "../util/ActionHistory" import { FileHandler } from "../util/file-handler/FileHandler" +import { dirname } from "../util/Path" import { AUDIO_EXT } from "./FileData" type ChartPropertyEditor = { @@ -109,7 +110,7 @@ export const CHART_PROPERTIES_DATA: { const dirButton = document.createElement("button") dirButton.onclick = () => { - const dir = app.chartManager.smPath.split("/").slice(0, -1).join("/") + const dir = dirname(app.chartManager.smPath) if (window.nw) { const fileSelector = document.createElement("input") fileSelector.type = "file" diff --git a/app/src/data/SMPropertiesData.ts b/app/src/data/SMPropertiesData.ts index ccaf54eb..98b57759 100644 --- a/app/src/data/SMPropertiesData.ts +++ b/app/src/data/SMPropertiesData.ts @@ -5,6 +5,7 @@ import { Icons } from "../gui/Icons" import { NumberSpinner } from "../gui/element/NumberSpinner" import { DirectoryWindow } from "../gui/window/DirectoryWindow" import { ActionHistory } from "../util/ActionHistory" +import { dirname } from "../util/Path" import { FileHandler } from "../util/file-handler/FileHandler" import { AUDIO_EXT, IMG_EXT } from "./FileData" @@ -338,7 +339,7 @@ export function createInputElement( input.onclick = ev => { ev.preventDefault() input.blur() - const dir = app.chartManager.smPath.split("/").slice(0, -1).join("/") + const dir = dirname(app.chartManager.smPath) if (window.nw) { const fileSelector = document.createElement("input") fileSelector.type = "file"