Closed pak21 closed 4 years ago
@pak21 thanks so much for the PR! You're definitely right, hardcoding the path was shortsighted, and totally screws anyone who installs to a different directory. I have an idea of how to fix this longer term, but in the meantime I'm totally fine with this going in. I will do my best to get this published to pypi sometime this week!
First of all, big thanks for the dynamic card finder, I've been missing my ELD cards :-)
That said, I can think of two scenarios in which the hardcoded
C:\Program Files (x86)\Wizards of the Coast\MTGA\MTGA_Data\Downloads\Data
isn't correct:C:\...
.This change (tested under Windows 10, WSL/Ubuntu and native boot Debian) allows at least a small amount of configuration for the location of the MTGA files. It does "the right thing" on Windows when the
ProgramFiles(x86)
environment variable exists, falling back toProgramFiles
if that doesn't exist, and allows bodging it a bit by explicitly settingProgramFiles
in the other environments.Technically, I think the fallback from
ProgramFiles(x86)
toProgramFiles
isn't necessary here as MTGA requires a 64-bit Windows install and that means thatProgramFiles(x86)
will always be set... but it's impossible to set an environment variable with parentheses in the name on a Unix-ish OS so it's handy to have anyway.If you think there's a better way of allowing the MTGA install location to be specified, feel free to ignore this patch and do that instead - in the longer term, there will probably be a need to support the upcoming macOS version as well.