MagicSetEditor2 icon indicating copy to clipboard operation
MagicSetEditor2 copied to clipboard

Fails to load packages if both system and user data directories exist

Open CaptainBeyondDS8 opened this issue 5 years ago • 0 comments

When both a system (/usr/local/share/magicseteditor/data) and user (~/.magicseteditor/data) data directory exist, MSE fails to load packages. Specifically, it appears to be concatenating the user and system data paths together, as in /usr/local/share/magicseteditor/data/home/malacoda/.magicseteditor/data/magic.mse-game. I reproduced this on a fresh install of Ubuntu 20.04 using the latest HEAD commit as of this time (c07a8ff8f6692668c0c65a7e8f09fa9884634a4a)

The set up involves placing the MSE data itself in /usr/local/share/magicseteditor/data and templates in ~/.magicseteditor/data. Attached is a script that illustrates what I did to create this scenario: install-mse.txt

Steps to reproduce:

  1. Build and install MSE binary to /usr/local/bin/magicseteditor
  2. Copy MSE resource and data directories to /usr/local/share/magicseteditor/
  3. Place Cajun-style templates in ~/.magicseteditor/data
  4. Launch MSE
  5. Click "New Set" button

Expected behavior: MSE shows available game types and card styles.

Actual behavior: Error message such as "Package not found: /usr/local/share/magicseteditor/data/home/malacoda/.magicseteditor/data/magic.mse-game".

mse-package-not-found

Game type/card style selection is unusable.

mse-package-not-found-2

strace logging confirms that MSE is indeed concatenating paths: strace.log

stat("/home/malacoda/.magicseteditor/data/home/malacoda/.magicseteditor/data/magic.mse-game", 0x7ffea7c6e610) = -1 ENOENT (No such file or directory)
stat("/home/malacoda/.magicseteditor/data/home/malacoda/.magicseteditor/data/magic.mse-game", 0x7ffea7c6e610) = -1 ENOENT (No such file or directory)
stat("/usr/local/share/magicseteditor/data/home/malacoda/.magicseteditor/data/magic.mse-game", 0x7ffea7c6e180) = -1 ENOENT (No such file or directory)
stat("/usr/local/share/magicseteditor/data/home/malacoda/.magicseteditor/data/magic.mse-game", 0x7ffea7c6e1e0) = -1 ENOENT (No such file or directory)
stat("/usr/local/share/magicseteditor/data/home/malacoda/.magicseteditor/data/magic.mse-game", 0x7ffea7c6e1e0) = -1 ENOENT (No such file or directory)

I tested this with the old 2.0.0 basic template set to confirm this was not somehow specific to the Cajun template set and found the same results.

CaptainBeyondDS8 avatar Sep 13 '20 05:09 CaptainBeyondDS8