cheat/install

21 lines
629 B
Plaintext
Raw Normal View History

#!/usr/bin/env python
import os
import os.path
import shutil
import sys
home = os.path.expanduser('~')
thisdir = os.path.dirname(os.path.abspath(__file__))
bindir = os.path.join(home, 'bin')
try:
if not os.path.isdir(bindir):
os.path.mkdir(bindir)
os.symlink(os.path.join(thisdir, './cheat'), os.path.join(bindir, 'cheat'))
os.symlink(os.path.join(thisdir, './.cheat'), os.path.join(home, '.cheat'))
print("cheat has been installed successfully.")
except IOError as e:
sys.stderr.write("Something went wrong: %s\n" % e)
sys.stderr.write("Your installation may be incomplete!\n")
sys.exit(1)