comparison orpg/dirpath/__init__.py @ 0:4385a7d0efd1 grumpy-goblin

Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
author sirebral
date Tue, 14 Jul 2009 16:41:58 -0500
parents
children 0b8b7e3ed78d
comparison
equal deleted inserted replaced
-1:000000000000 0:4385a7d0efd1
1 # Old dirpath.py replaced with new dirpath 'package/module' to allow dynamic
2 # checking on directory structure at dirpath import without requiring alteration
3 # of almost every openrpg1 python file
4 #
5 # This module is functionally identical to the dirpath.py file it replaces.
6 # All directory locations are now handled by the load_paths() function
7 # in the dirpath_tools.py file -- Snowdog 3-8-05
8
9 # CHANGE LOG
10 # -----------------------------
11 # * Reworked path verification process to attempt to fall back on the
12 # current working directory if approot fails to verify before
13 # asking the user to locate the root directory -- Snowdog 12-20-05
14
15 import sys
16 import os
17 from dirpath_tools import *
18
19 root_dir = None
20
21 try:
22 import approot
23 root_dir = approot.basedir
24 except:
25 #attempt to load default path
26 t = __file__.split(os.sep)
27 if len(t) > 2:
28 root_dir = os.sep.join(t[:-3])
29 else:
30 root_dir = os.getcwd() #default ORPG root dir
31
32 dir_struct = {}
33
34 if not verify_home_path(root_dir):
35 root_dir = os.getcwd()
36 if not verify_home_path(root_dir):
37 root_dir = get_user_located_root()
38 while not verify_home_path(root_dir):
39 root_dir = get_user_located_root()
40
41 #switch backslashes to forward slashes just for display on screen only (avoids issues with escaped characters)
42 clean = str(root_dir)
43 clean = str.replace(clean,'\\','/')
44 print "Rooting OpenRPG at: " + clean
45
46 load_paths(dir_struct, root_dir)