Merge branch 'master' of https://github.com/smartboyathome/cheat into smartboyathome-master

* 'master' of https://github.com/smartboyathome/cheat:
  Making the default cheats directory Windows-compatible.
This commit is contained in:
Chris Lane 2013-08-21 22:24:56 -04:00
commit 2b9d48c8c4
1 changed files with 5 additions and 3 deletions

8
cheat
View File

@ -2,9 +2,11 @@
import os import os
import sys import sys
DEFAULT_CHEAT_DIR = os.path.join(os.path.expanduser('~'), '.cheats')
# assembles a list of directories containing cheatsheets # assembles a list of directories containing cheatsheets
def cheat_directories(): def cheat_directories():
default_directories = [os.path.expanduser('~/.cheat')] default_directories = [DEFAULT_CHEAT_DIR]
try: try:
import cheatsheets import cheatsheets
default_directories.append(cheatsheets.cheat_dir) default_directories.append(cheatsheets.cheat_dir)
@ -35,8 +37,8 @@ def main():
# verify that we have at least one cheat directory # verify that we have at least one cheat directory
if not cheat_dirs: if not cheat_dirs:
print >> sys.stderr, \ error_msg = 'The {default} dir does not exist or the CHEATPATH var is not set.'
'The ~/.cheat dir does not exist or the CHEATPATH var is not set.' print >> sys.stderr, error_msg.format(default=DEFAULT_CHEAT_DIR)
exit() exit()
# list the files in the ~/.cheat directory # list the files in the ~/.cheat directory