nixpkgs-suyu/pkgs/games/clonehero/xdg-wrapper.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
895 B
Nix
Raw Normal View History

2019-08-23 14:12:52 +02:00
{ stdenv, clonehero-unwrapped, writeScript }:
# Clone Hero doesn't have an installer, so it just stores configuration & data relative to the binary.
# This wrapper works around that limitation, storing game configuration & data in XDG_CONFIG_HOME.
let
name = "clonehero";
desktopName = "Clone Hero";
in
writeScript "${name}-xdg-wrapper-${clonehero-unwrapped.version}" ''
#!${stdenv.shell} -e
configDir="''${XDG_CONFIG_HOME:-$HOME/.config}/unity3d/srylain Inc_/${desktopName}"
mkdir -p "$configDir"
# Force link shipped clonehero_Data, unless directory already exists (to allow modding)
if [ ! -d "$configDir/clonehero_Data" ] || [ -L "$configDir/clonehero_Data" ]; then
ln -snf ${clonehero-unwrapped}/share/clonehero_Data "$configDir"
fi
# Fake argv[0] to emulate running in the config directory
exec -a "$configDir/${name}" ${clonehero-unwrapped}/bin/${name} "$@"
''