ogri-la / strongbox

a World of Warcraft Addon Manager aimed at Linux players
GNU Affero General Public License v3.0
167 stars 7 forks source link

File picker error when configuring wowman #48

Closed layday closed 5 years ago

layday commented 5 years ago

I encountered this issue after upgrading to 0.9.0 though I wasn't sure if I should report it because I don't use Linux. This happens when you open the add-on folder in the picker, then press 'Select' without a folder being selected (highlighted). wowman (or the underlying library) expects that you should highlight the add-on folder, then press select without opening it. What appears to be happening is that it stores the name of the previously-selected item in the 'File' field and appends it to the path. Here's the full trace:

ERROR [wowman.ui.gui:98] -                               java.lang.Thread.run              Thread.java:  835
java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  628
 java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1128
               java.util.concurrent.FutureTask.run          FutureTask.java:  264
                                               ...
               clojure.core/binding-conveyor-fn/fn                 core.clj: 2022
                 wowman.ui.gui/async-handler/fn/fn                  gui.clj:   96
          wowman.ui.gui/configure-app-panel/picker                  gui.clj:  239
                                               ...
           orchestra.spec.test/spec-checking-fn/fn                 test.clj:  124
     orchestra.spec.test/spec-checking-fn/conform!                 test.clj:  113
                              clojure.core/ex-info                 core.clj: 4739
clojure.lang.ExceptionInfo: Call to wowman.core/set-addon-dir! did not conform to spec:
                            "[...]/World of Warcraft/_classic_/Interface/AddOns/AddOns" - failed: directory? in: [0] at: [:args :addon-dir] spec: :wowman.specs/extant-dir

        clojure.spec.alpha/args: ("[...]/World of Warcraft/_classic_/Interface/AddOns/AddOns")
    clojure.spec.alpha/failure: :instrument
    clojure.spec.alpha/problems: [{:path [:args :addon-dir],
                                :pred me.raynes.fs/directory?,
                                :val
                                "[...]/World of Warcraft/_classic_/Interface/AddOns/AddOns",
                                :via [:wowman.specs/extant-dir :wowman.specs/extant-dir],
                                :in [0]}]
        clojure.spec.alpha/spec: #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x4e8832ee "clojure.spec.alpha$regex_spec_impl$reify__2509@4e8832ee"]
    clojure.spec.alpha/value: ("[...]/World of Warcraft/_classic_/Interface/AddOns/AddOns")
    orchestra.spec.test/caller: {:file "gui.clj",
                                :line 239,
                                :var-scope wowman.ui.gui/configure-app-panel,
                                :local-fn picker}

This works:

Screenshot 2019-09-18 at 05 27 26

This doesn't:

Screenshot 2019-09-18 at 05 28 32
layday commented 5 years ago

I originally commented on #47 but I was probably wrong in thinking it was the same issue. Please feel free to close this issue if you can't reproduce it on Linux.

torkus commented 5 years ago

"[...]/World of Warcraft/classic/Interface/AddOns/AddOns"

did you '[...]' snip the paths or was that part of the output?

layday commented 5 years ago

I snipped the paths.

torkus commented 5 years ago

I can't replicate the error precisely but I can generate a similar stacktrace if I enter garbage into the field, or, like in your example where you have ".../AddOns/AddOns" happening. I bet that directory doesn't exist.

I'll add some nicer checking around that dialog

torkus commented 5 years ago

Please feel free to close this issue if you can't reproduce it on Linux.

I'm pretty chuffed it's working on a mac. I can't support it, I don't own one, but there is no harm in reporting errors even when you think they are Mac-only.

torkus commented 5 years ago

PR: https://github.com/ogri-la/wowman/pull/49/files

I don't think this change will solve your problem @layday , but it might make the problem less obscure.

Screenshot at 2019-09-18 22-06-40

layday commented 5 years ago

I did some digging and if I change the :type to :open on line 239 in gui.clj, I get an 'Open' dialogue sans the 'File' input box. It would seem changing the button text in seesaw has the unfortunate side-effect of changing the dialogue type to whatever the generic default in Swing is.

Screenshot 2019-09-18 at 16 04 26
torkus commented 5 years ago

http://daveray.github.io/seesaw/seesaw.chooser-api.html#seesaw.chooser/choose-file

:type The dialog type: :open, :save, or a custom string placed on the Ok button. Defaults to :open.

does ":open" fix the problem for you?

layday commented 5 years ago

Yes, indeed. Though it does also mean you can't create folders that way.

torkus commented 5 years ago

well, in this case we're selecting a pre-existing addon directory "AddOns" rather than creating a new directory. Nothing changes under linux except the label from "select" to "open", including the ability to create directories.

I'll change this to :open as it seems better behaved for mac users

update: PR

torkus commented 5 years ago

Thank you for the bug report. Are you new to Clojure?

layday commented 5 years ago

Brand-sparkling new - I installed it to play around with wowman.

torkus commented 5 years ago

oh cool

here is my workflow and a small tour from the REPL in a nutshell:


$ lein repl
nREPL server started on port 33747 on host 127.0.0.1 - nrepl://127.0.0.1:33747
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.9.0
OpenJDK 64-Bit Server VM 1.8.0_222-b05
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

wowman.main=> (restart)
2019-09-18 14:46:30.670 rama INFO [wowman.ui.gui:738] - stopping gui
2019-09-18 14:46:30.695 rama INFO [wowman.core:877] - stopping app
2019-09-18 14:46:31.447 rama INFO [wowman.core:868] - starting app
2019-09-18 14:46:31.507 rama INFO [wowman.ui.gui:733] - starting gui
nil
wowman.main=> 
2019-09-18 14:46:32.107 rama INFO [wowman.core:446] - (re)loading installed addons: /home/torkus/foo
2019-09-18 14:46:32.353 rama INFO [wowman.core:466] - loading addon summaries from catalog: /home/torkus/.local/share/wowman/catalog.json
2019-09-18 14:46:32.794 rama INFO [wowman.core:557] - matching installed addons to online addons
2019-09-18 14:46:32.906 rama INFO [wowman.core:612] - checking for updates
2019-09-18 14:46:33.220 rama INFO [wowman.core:614] - done checking for updates

wowman.main=> ;; [make some changes in your editor]

wowman.main=> (clojure.tools.namespace.repl/refresh-all)
:reloading (wowman.logging wowman.specs wowman.utils wowman.nfo wowman.toc wowman.zip wowman.http wowman.wowinterface-api wowman.curseforge-api wowman.catalog wowman.core wowman.ui.gui wowman.wowinterface wowman.curseforge wowman.ui.cli wowman.main wowman.main-test wowman.cli-test wowman.toc-test wowman.curseforge-test wowman.test-helper wowman.gui-test wowman.utils-test wowman.wowinterface-test wowman.core-test wowman.zip-test wowman.curseforge-api-test wowman.catalog-test wowman.http-test)
:ok
wowman.main=> ;; reload all namespaces for the most clean refresh possible

wowman.main=> (clojure.tools.namespace.repl/refresh)
:reloading ()
:ok
wowman.main=> ;; that also works, but develop branch is now using a database that should be rebuilt on each refresh

wowman.main=> ;; it's a pain, but it's getting better

wowman.main=> ;; this is the 'wowman.main' namespace, found in src/wowman/main.clj

wowman.main=> ;; it's like the application bootstrap

wowman.main=> (ns wowman.core)
nil
wowman.core=> ;; this is the 'wowman.core' namespace, where most of the 'business' logic lives

wowman.core=> (get-state :cfg)

RuntimeException application must be `start`ed before state may be accessed.  wowman.core/get-state (core.clj:124)
wowman.core=> ;; after a refresh, the application must be started again

wowman.core=> (restart)

CompilerException java.lang.RuntimeException: Unable to resolve symbol: restart in this context, compiling:(/tmp/form-init5864672377923725429.clj:1:1) 
wowman.core=> ;; doesn't work because we're no longer in the 'wowman.main' namespace (ns)

wowman.core=> (ns wowman.main)
nil
wowman.main=> (restart)
2019-09-18 14:50:46.191 rama INFO [wowman.ui.gui:738] - stopping gui
2019-09-18 14:50:46.195 rama INFO [wowman.core:877] - stopping app
2019-09-18 14:50:46.948 rama INFO [wowman.core:868] - starting app
2019-09-18 14:50:46.975 rama INFO [wowman.ui.gui:733] - starting gui
nil
2019-09-18 14:50:47.064 rama INFO [wowman.core:446] - (re)loading installed addons: /home/torkus/foo
wowman.main=> 2019-09-18 14:50:47.193 rama INFO [wowman.core:466] - loading addon summaries from catalog: /home/torkus/.local/share/wowman/catalog.json
2019-09-18 14:50:47.573 rama INFO [wowman.core:557] - matching installed addons to online addons
2019-09-18 14:50:47.663 rama INFO [wowman.core:612] - checking for updates
2019-09-18 14:50:47.891 rama INFO [wowman.core:614] - done checking for updates

wowman.main=> (ns wowman.core)
nil
wowman.core=> (get-state :cfg)
{:debug? false, :addon-dir-list [{:addon-dir "/home/torkus/foo", :game-track "retail"} {:addon-dir "/home/torkus/bar", :game-track "retail"} {:addon-dir "/home/torkus/baz", :game-track "retail"}]}
wowman.core=> ;; there we go.

wowman.core=> ;; application state is tracked in the 'wowman.core/state' atom

wowman.core=> ;; I access it through a little function that ensures the application is started first called 'wowman.core/get-state'

wowman.core=> ;; without arguments 'wowman.core/get-state' just returns all the state

wowman.core=> ;; with arguments, you can dig into nested data structures

wowman.core=> (get-state)

[snip]

wowman.core=> ;; total mess

wowman.core=> ;; this is because I'm on a branch forked from master that doesn't have the database yet

wowman.core=> ;; the whole catalog is there, loaded in to the application state

wowman.core=> (clojure.pprint/pprint (dissoc (get-state) :addon-summary-list))
{:cfg
 {:debug? false,
  :addon-dir-list
  [{:addon-dir "/home/torkus/foo", :game-track "retail"}
   {:addon-dir "/home/torkus/bar", :game-track "retail"}
   {:addon-dir "/home/torkus/baz", :game-track "retail"}]},
 :selected-search [],
 :search-field-input nil,
 :selected-installed nil,
 :installed-addon-list
 ([snip]),
 :selected-addon-dir "/home/torkus/foo",
 :gui
 #object[seesaw.core.proxy$javax.swing.JFrame$Tag$fd407141 0x1f0b9ac8 "seesaw.core.proxy$javax.swing.JFrame$Tag$fd407141[frame0,1354,0,1206x1080,invalid,layout=java.awt.BorderLayout,title=wowman,resizable,iconified,defaultCloseOperation=DISPOSE_ON_CLOSE,rootPane=javax.swing.JRootPane[,1,19,1204x1060,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]"],
 :file-opts
 {:debug? false,
  :addon-dir-list
  [{:addon-dir "/home/torkus/foo", :game-track "retail"}
   {:addon-dir "/home/torkus/bar", :game-track "retail"}
   {:addon-dir "/home/torkus/baz", :game-track "retail"}]},
 :etag-db
 {},
 :unsteady-addons #{},
 :cli-opts {},
 :cleanup
 [#object[wowman.core$state_bind$rmwatch__24992 0x4a692d02 "wowman.core$state_bind$rmwatch__24992@4a692d02"]
  #object[wowman.core$state_bind$rmwatch__24992 0xac15c0f "wowman.core$state_bind$rmwatch__24992@ac15c0f"]
  #object[wowman.core$state_bind$rmwatch__24992 0x4ff87999 "wowman.core$state_bind$rmwatch__24992@4ff87999"]
  #object[wowman.core$state_bind$rmwatch__24992 0x76ccfa48 "wowman.core$state_bind$rmwatch__24992@76ccfa48"]
  #object[wowman.core$state_bind$rmwatch__24992 0x75ced8ae "wowman.core$state_bind$rmwatch__24992@75ced8ae"]
  #object[wowman.core$state_bind$rmwatch__24992 0x75efc33c "wowman.core$state_bind$rmwatch__24992@75efc33c"]
  #object[wowman.core$state_bind$rmwatch__24992 0x795758a9 "wowman.core$state_bind$rmwatch__24992@795758a9"]
  #object[wowman.core$state_bind$rmwatch__24992 0x68d8f371 "wowman.core$state_bind$rmwatch__24992@68d8f371"]
  #object[wowman.core$state_bind$rmwatch__24992 0x6b504d6c "wowman.core$state_bind$rmwatch__24992@6b504d6c"]
  #object[wowman.core$state_bind$rmwatch__24992 0x602d9519 "wowman.core$state_bind$rmwatch__24992@602d9519"]]}
nil

wowman.core=> ;; that gives us the current running state sans the catalog

wowman.core=> ;; I also snipped a few large things out

wowman.core=> (ns wowman.main)
nil
wowman.main=> ;; I do most things from wowman.main ns

wowman.main=> (wowman.ui.cli/action :list)
28 installed addons
AGT (1.4.6)
AtlasLoot (v8.10.00)
Auc-Advanced (AuctioneerSuite-8.2.6382.zip)
AutoLootPlus (AutoLootPlus 2.0.0 (Retail))
Bagnon (8.2.0)
Bartender4 (4.8.7)
BigWigs (v167.1)
Carbonite (v8.2.0)
DBM-AQ40 (r667)
DBM-Azeroth-BfA (8.2.18)
GatherMate2 (1.45)
Grid (8.0.1.1)
GTFO (4.49.1)
HealBot (8.2.0.6)
ImprovedLootFrame (3.7.4)
MasterPlan (0.116)
MuffinFactionizer (v8.0.0.06)
NPCScan (8.0.1.13)
OmniCC (8.2.3)
OPie (Walnut 3)
Recount (v8.2.0c)
SaySapped (SaySapped 190827-retail)
Skada (1.7.6)
TidyPlates (6.19.3)
Titan (5.18.2.80200)
TradeSkillMaster (v4.8.7)
WeakAuras (2.14.6)
WorldQuestTracker (v8.2.0.382)
nil

wowman.main=> (wowman.ui.cli/action :list-updates)
28 installed
4 updates
Bagnon (8.2.0 => 8.2.13)
DBM-Azeroth-BfA (8.2.18 => 8.2.19)
Recount (v8.2.0c => v8.2.0d)
TradeSkillMaster (v4.8.7 => v4.8.8)
nil
torkus commented 5 years ago

have to dash now but let me know if you need help with anything.

torkus commented 5 years ago

oh, and couldn't help myself (only available on the develop branch):


wowman.main=> (core/db-query "select count(*) from catalog")
[{:count(*) 6605}]

wowman.main=> (clojure.pprint/pprint (core/db-query "select * from catalog limit 10"))
[{:description nil,
  :updated-date "2016-12-13T08:35:00Z",
  :retail-track true,
  :name "-cursor",
  :source "wowinterface",
  :alt-name "cursor",
  :vanilla-track false,
  :label "_Cursor",
  :download-count 73424,
  :source-id 10531,
  :uri "https://www.wowinterface.com/downloads/info10531"}
 {:description nil,
  :updated-date "2018-09-21T16:57:00Z",
  :retail-track true,
  :name "-detailedcloudsfix-80000-1",
  :source "wowinterface",
  :alt-name "detailedcloudsfix800001",
  :vanilla-track false,
  :label "!DetailedCloudsFix 80000.1",
  :download-count 1845,
  :source-id 22941,
  :uri "https://www.wowinterface.com/downloads/info22941"}
 {:description nil,
  :updated-date "2017-09-21T03:12:00Z",
  :retail-track true,
  :name "-npcscan-overlay",
  :source "wowinterface",
  :alt-name "npcscanoverlay",
  :vanilla-track false,
  :label "_NPCScan.Overlay",
  :download-count 283636,
  :source-id 14686,
  :uri "https://www.wowinterface.com/downloads/info14686"}
 {:description nil,
  :updated-date "2018-07-31T11:24:00Z",
  :retail-track true,
  :name "-sylevel",
  :source "wowinterface",
  :alt-name "sylevel",
  :vanilla-track false,
  :label "!SyLevel",
  :download-count 8821,
  :source-id 22452,
  :uri "https://www.wowinterface.com/downloads/info22452"}
 {:description "A New Simple Percent",
  :updated-date "2019-09-02T18:40:13.293Z",
  :retail-track false,
  :name "a-new-simple-percent",
  :source "curseforge",
  :alt-name "anewsimplepercent",
  :vanilla-track false,
  :label "A New Simple Percent",
  :download-count 326,
  :source-id 319346,
  :uri "https://www.curseforge.com/wow/addons/a-new-simple-percent"}
 {:description
  "Plays the \"A Turtle Made It To The Water\" Song by CatDany everytime the quest \"Beachhead\" is started.",
  :updated-date "2018-08-30T16:47:02.17Z",
  :retail-track false,
  :name "a-turtle-made-it-to-the-water",
  :source "curseforge",
  :alt-name "aturtlemadeittothewater",
  :vanilla-track false,
  :label "A Turtle Made It To The Water",
  :download-count 3256,
  :source-id 301976,
  :uri
  "https://www.curseforge.com/wow/addons/a-turtle-made-it-to-the-water"}
 {:description
  "Addon to quickly view progress on hidden achieves for artifact appearances",
  :updated-date "2018-08-13T01:06:02.397Z",
  :retail-track false,
  :name "a4t",
  :source "curseforge",
  :alt-name "alternateartifactappearanceachievementtracker",
  :vanilla-track false,
  :label "Alternate Artifact Appearance Achievement Tracker",
  :download-count 8612,
  :source-id 103281,
  :uri "https://www.curseforge.com/wow/addons/a4t"}
 {:description "Auto ActionCam",
  :updated-date "2016-10-30T16:05:06.5Z",
  :retail-track false,
  :name "aac",
  :source "curseforge",
  :alt-name "autoactioncam",
  :vanilla-track false,
  :label "Auto ActionCam",
  :download-count 13517,
  :source-id 102870,
  :uri "https://www.curseforge.com/wow/addons/aac"}
 {:description
  "Data Broker plugin for displaying in-game mail status notifications.",
  :updated-date "2018-09-01T01:57:56.713Z",
  :retail-track false,
  :name "aanye-mail",
  :source "curseforge",
  :alt-name "aanyemail",
  :vanilla-track false,
  :label "Aanye Mail",
  :download-count 3074,
  :source-id 53302,
  :uri "https://www.curseforge.com/wow/addons/aanye-mail"}
 {:description
  "Data Broker plugin for tracking experience and reputation.",
  :updated-date "2018-09-04T05:33:39.34Z",
  :retail-track false,
  :name "aanye_xp",
  :source "curseforge",
  :alt-name "aanyexp",
  :vanilla-track false,
  :label "Aanye XP",
  :download-count 9158,
  :source-id 22872,
  :uri "https://www.curseforge.com/wow/addons/aanye_xp"}]
nil
wowman.main=> 
layday commented 5 years ago

Awesome, thanks. The syntax is a little foreign to me, I've never used a lisp before.

torkus commented 5 years ago

That's fine, learning a new language takes years.

A few things that helped me: