xdissent / ievms

Automated installation of the Microsoft IE App Compat virtual machines
http://xdissent.github.com/ievms
9.86k stars 497 forks source link

Follow the XDG directory spec for ~/.ievms #244

Open jasonkarns opened 9 years ago

jasonkarns commented 9 years ago

I would love to see ievms start to support the XDG base directory spec. Rather than using $HOME as a dumping ground (and preventing configurable paths), ievms should be using $XDG_CACHE_HOME and $XDG_DATA_HOME.

*.vmdk files would be placed under $XDG_DATA_HOME/ievms/

All other files would be placed under $XDG_CACHE_HOME/ievms/

xdissent commented 9 years ago

Ah, good idea, but many ievms users are on OS X (myself included). I suppose ~/Library/Application Support/ievms and ~/Library/Caches/ievms/would be the equivalent? I too am annoyed by HOME pollution, so I'll put some thought into how to support this and migrate existing users. Thanks for the proposal!

jasonkarns commented 9 years ago

I don't think there needs to be a distinction for OS X. It's a nix enough that all the expected directories are there, there are already other CLI tools that follow XDG on mac, and developers (who are the target audience for ievms) use OS X as a nix.

To be clear, the spec-defined defaults are:

(And apps usually create an app-named folder beneath each of the above directories)

Of all the tools that I've seen do a transition to the basedir spec, I've only seen one common migration path. Use the legacy paths if the legacy paths exist AND the XDG_ env vars are not set. Otherwise, use the new paths. This means there is no impact to existing users who haven't manually opted-in to the XDG setup. Existing users who have opted in by manually setting the env vars would obviously use the defined env vars. New users will get the XDG defaults (unless they have overridden the env vars, which would be used instead).

Now this transition path is fairly straightforward for most apps that need to read and write config files. To my knowledge, ievms does not have any config files; only cache and data files. And we also have to think how this will impact iectrl

jasonkarns commented 9 years ago

I just a completely fresh install of my ievms, and configured INSTALL_PATH to be $XDG_DATA_HOME/ievms. So far things seem to be working, though there are some minor issues with iectrl finding the vms.

For reference, my ievms install command was:

curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="8 9 10 11" INSTALL_PATH="${XDG_DATA_HOME}/ievms" REUSE_XP="no" bash