Skip to content

Commit

Permalink
Fix dirname not being used for uploading audio files
Browse files Browse the repository at this point in the history
SMPath uses "/" as delimiter, which breaks on windows
  • Loading branch information
tillvit committed Sep 3, 2024
1 parent 2edb34a commit 83bc3df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/src/data/ChartListWindowData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion app/src/data/SMPropertiesData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 83bc3df

Please sign in to comment.