mmyers / eug

Modding tools for Paradox games including Europa Universalis IV and Crusader Kings II
47 stars 10 forks source link

[Victoria 2] [0.9.7 beta 2] Unable to load definition.csv from mods on Linux #29

Closed mikoxyz closed 3 years ago

mikoxyz commented 3 years ago

On Linux, you are unable to load a mod's definition.csv. This seems to be because the path gets mangled up somewhere in the process, which results in a .. being added between the path to the game folder and the path to the mod itself.


Jul 28, 2021 9:27:55 PM editor.Main main
INFO: Java version: 16.0.2
Jul 28, 2021 9:27:55 PM editor.Main main
INFO: Editor version: 0.9.6
Jul 28, 2021 9:27:55 PM editor.Main listMods
INFO: Checking for mods in /home/miko/Victoria 2/mod
Jul 28, 2021 9:27:55 PM editor.Main listMods
INFO: Mod: Historical Project Mod 0.4.6; file path: /home/miko/Victoria 2/mod/HPM.mod; mod path: /home/miko/Victoria 2/mod/HPM
Jul 28, 2021 9:27:55 PM editor.Main listMods
INFO: Mod: Shatter 0.1.0; file path: /home/miko/Victoria 2/mod/shatter.mod; mod path: /home/miko/Victoria 2/mod/shatter
Jul 28, 2021 9:27:55 PM editor.Main listMods
INFO: Mod: Wild West submod for HPM/HFM (0.1.0); file path: /home/miko/Victoria 2/mod/wild_west.mod; mod path: /home/miko/Victoria 2/mod/wild-west
Jul 28, 2021 9:27:55 PM editor.Main listMods
INFO: Mod: Greater Flavor Mod; file path: /home/miko/Victoria 2/mod/GFM.mod; mod path: /home/miko/Victoria 2/mod/GFM
Jul 28, 2021 9:27:55 PM editor.Main listMods
INFO: Checking for mods in /home/miko/Paradox Interactive/Victoria 2/mod
Jul 28, 2021 9:27:58 PM editor.Main$4 actionPerformed
INFO: **************************************************
Jul 28, 2021 9:27:58 PM editor.Main$4 actionPerformed
INFO: Loading A House Divided. Mod: Greater Flavor Mod
Jul 28, 2021 9:27:58 PM editor.Main$4 actionPerformed
INFO: Game path: /home/miko/Victoria 2
Jul 28, 2021 9:27:58 PM editor.Main$4 actionPerformed
INFO: Mod path: /home/miko/Victoria 2/mod/GFM
Loading /home/miko/Victoria 2/mod/GFM.mod.
Loading took 270173 ns.

Loading /home/miko/Victoria 2/mod/GFM.mod.
Loading took 203798 ns.

Jul 28, 2021 9:27:58 PM editor.ProvinceData <init>
SEVERE: /home/miko/Victoria 2/../mod/GFM/map/definition.csv (No such file or directory)
java.io.FileNotFoundException: /home/miko/Victoria 2/../mod/GFM/map/definition.csv (No such file or directory)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:211)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:153)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:108)
    at java.base/java.io.FileReader.<init>(FileReader.java:60)
    at editor.ProvinceData.parseDefs(ProvinceData.java:65)
    at editor.ProvinceData.<init>(ProvinceData.java:44)
    at editor.EditorUI.<init>(EditorUI.java:81)
    at editor.Main.startEditor(Main.java:342)
    at editor.Main.access$300(Main.java:42)
    at editor.Main$4.actionPerformed(Main.java:290)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
    at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6617)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
    at java.desktop/java.awt.Component.processEvent(Component.java:6382)
    at java.desktop/java.awt.Container.processEvent(Container.java:2264)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4993)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2322)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4934)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4563)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4504)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2308)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
    at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)```
mmyers commented 3 years ago

I am looking at https://github.com/Historical-Expansion-Mod/Greater-Flavor-Mod/blob/master/GFM/map/default.map. If that is the map file used for GFM, then the .. is present in the file and was not added by the editor.

The real problem seems to be that the editor is treating the filename as relative to the game folder, while the game apparently treats it as relative to the map folder. At least on my Windows machine, having two dots in the path is perfectly valid as long as it results in a file that exists. But in your case the two dots drops us clear out of the Victoria 2 folder.

I'm not sure why the path has to be constructed that way. Doesn't it simply direct to the definition.csv in the mod's map folder? Why can't it just be "definition.csv"?

mikoxyz commented 3 years ago

I am looking at https://github.com/Historical-Expansion-Mod/Greater-Flavor-Mod/blob/master/GFM/map/default.map. If that is the map file used for GFM, then the .. is present in the file and was not added by the editor.

The real problem seems to be that the editor is treating the filename as relative to the game folder, while the game apparently treats it as relative to the map folder. At least on my Windows machine, having two dots in the path is perfectly valid as long as it results in a file that exists. But in your case the two dots drops us clear out of the Victoria 2 folder.

I'm not sure why the path has to be constructed that way. Doesn't it simply direct to the definition.csv in the mod's map folder? Why can't it just be "definition.csv"?

Good question; it seems to break the mod in-game (seems to load the definitions from vanilla, instead), but I'm not really sure why. Removing the ../ from the definitions does seem to resolve my issue in the editor, but then it's unable to load the definitions in-game during loadtime.

mmyers commented 3 years ago

Further research indicates that this is limited to just the definitions file, just in Victoria 2. Probably a game bug. I can special-case the parsing to account for files with .. in their paths.

mikoxyz commented 3 years ago

Thanks!

On Fri, 6 Aug 2021, 04:03 mmyers, @.***> wrote:

Closed #29 https://github.com/mmyers/eug/issues/29 via 2b8a5c9 https://github.com/mmyers/eug/commit/2b8a5c9e37930b59a127683e01549475ce10ccb8 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mmyers/eug/issues/29#event-5120525553, or unsubscribe https://github.com/notifications/unsubscribe-auth/APQQTOYUMAAAOSKLGTVKN4LT3M7HXANCNFSM5BE7YM2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .