Skip to content

Commit

Permalink
Open files by dragging onto the app
Browse files Browse the repository at this point in the history
  • Loading branch information
tillvit committed Aug 14, 2024
1 parent f9b4c85 commit 99870e0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions app/src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,23 @@ export class App {
const win = nw.Window.get()

nw.App.on("open", args => {
console.log(args)
nw.Window.open(window.location.href)
if (!args || args?.length === 0) {
nw.Window.open(window.location.href)
return
}
let foundSM = ""
for (const file of args) {
if (extname(file) == ".ssc") {
foundSM = file
break
} else if (foundSM == "" && extname(file) == ".sm") {
foundSM = file
}
}
if (foundSM != "") {
this.chartManager.loadSM(foundSM)
this.windowManager.getWindowById("select_sm_initial")?.closeWindow()
}
})

window.addEventListener("keydown", e => {
Expand Down

0 comments on commit 99870e0

Please sign in to comment.