Making the default cheats directory Windows-compatible.

This commit is contained in:
Alex Abbott 2013-08-20 14:56:12 -07:00
parent 1e26280da7
commit b188629b92
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