lol
1{ stdenv, clonehero-unwrapped, writeScript }:
2
3# Clone Hero doesn't have an installer, so it just stores configuration & data relative to the binary.
4# This wrapper works around that limitation, storing game configuration & data in XDG_CONFIG_HOME.
5let
6 name = "clonehero";
7 desktopName = "Clone Hero";
8in
9writeScript "${name}-xdg-wrapper-${clonehero-unwrapped.version}" ''
10 #!${stdenv.shell} -e
11 configDir="''${XDG_CONFIG_HOME:-$HOME/.config}/unity3d/srylain Inc_/${desktopName}"
12 mkdir -p "$configDir"
13
14 # Force link shipped clonehero_Data, unless directory already exists (to allow modding)
15 if [ ! -d "$configDir/clonehero_Data" ] || [ -L "$configDir/clonehero_Data" ]; then
16 ln -snf ${clonehero-unwrapped}/share/clonehero_Data "$configDir"
17 fi
18
19 # Fake argv[0] to emulate running in the config directory
20 exec -a "$configDir/${name}" ${clonehero-unwrapped}/bin/${name} "$@"
21''