comparison orpg/dirpath/dirpath_tools.py @ 14:0b8b7e3ed78d traipse_dev

Adding fixes from OpenRPG 1.8.0 Includes GUI patch for Linux users, init2 plugin, cherrypy XML refrence Completely removes approot from the startup process and creates a software cleanup process as well.
author sirebral
date Mon, 20 Jul 2009 21:25:13 -0500
parents 4385a7d0efd1
children 4840657c23c5
comparison
equal deleted inserted replaced
13:3add6bbc3a56 14:0b8b7e3ed78d
21 dir_struct["dnd3e"] = dir_struct["data"] + "dnd3e" + os.sep 21 dir_struct["dnd3e"] = dir_struct["data"] + "dnd3e" + os.sep
22 dir_struct["dnd35"] = dir_struct["data"] + "dnd35" + os.sep 22 dir_struct["dnd35"] = dir_struct["data"] + "dnd35" + os.sep
23 dir_struct["SWd20"] = dir_struct["data"] + "SWd20" + os.sep 23 dir_struct["SWd20"] = dir_struct["data"] + "SWd20" + os.sep
24 dir_struct["icon"] = dir_struct["home"] + "images" + os.sep 24 dir_struct["icon"] = dir_struct["home"] + "images" + os.sep
25 dir_struct["template"] = dir_struct["core"] + "templates" + os.sep 25 dir_struct["template"] = dir_struct["core"] + "templates" + os.sep
26
27 dir_struct["plugins"] = dir_struct["home"] + "plugins" + os.sep 26 dir_struct["plugins"] = dir_struct["home"] + "plugins" + os.sep
28 dir_struct["nodes"] = dir_struct["template"] + "nodes" + os.sep 27 dir_struct["nodes"] = dir_struct["template"] + "nodes" + os.sep
29 dir_struct["rollers"] = dir_struct["core"] + "dieroller" + os.sep + "rollers" + os.sep 28 dir_struct["rollers"] = dir_struct["core"] + "dieroller" + os.sep + "rollers" + os.sep
30 29
31 30
75 # an error occured while verifying the directory structure 74 # an error occured while verifying the directory structure
76 # bail out with error signal 75 # bail out with error signal
77 return 0 76 return 0
78 77
79 #all files and directories exist. 78 #all files and directories exist.
80 write_approot(path)
81 return 1 79 return 1
82 80
83 81
84 82
85 #------------------------------------------------------- 83 #-------------------------------------------------------
110 app.MainLoop() 108 app.MainLoop()
111 109
112 dir = None 110 dir = None
113 111
114 try: 112 try:
115 msg = "OpenRPG cannot locate critical files.\nPlease locate the openrpg1 directory in the following window" 113 msg = "OpenRPG cannot locate critical files.\nPlease locate the /System/ directory in the following window"
116 alert= wx.MessageDialog(None,msg,"Warning",wx.OK|wx.ICON_ERROR) 114 alert= wx.MessageDialog(None,msg,"Warning",wx.OK|wx.ICON_ERROR)
117 alert.Show() 115 alert.Show()
118 if alert.ShowModal() == wx.OK: 116 if alert.ShowModal() == wx.OK:
119 alert.Destroy() 117 alert.Destroy()
120 dlg = wx.DirDialog(None, "Locate the openrpg1 directory:",style=wx.DD_DEFAULT_STYLE) 118 dlg = wx.DirDialog(None, "Locate the openrpg1 directory:",style=wx.DD_DEFAULT_STYLE)
129 print "please delete the files ./openrpg/orpg/dirpath/aproot.py and ./openrpg/orpg/dirpath/aproot.pyc and try again." 127 print "please delete the files ./openrpg/orpg/dirpath/aproot.py and ./openrpg/orpg/dirpath/aproot.pyc and try again."
130 else: 128 else:
131 dir = raw_input("Enter the full path to your openrpg folder: ") 129 dir = raw_input("Enter the full path to your openrpg folder: ")
132 return dir 130 return dir
133 131
134
135
136 #-------------------------------------------------------
137 # void write_approot( orpg_root_path )
138 # added by snowdog 3-10-05
139 #-------------------------------------------------------
140
141 def write_approot( orpg_root_path):
142 try:
143 #if a trailing path separator is on the path string remove it.
144 if (orpg_root_path[(len(orpg_root_path)-len(os.sep)):] == os.sep):
145 orpg_root_path = orpg_root_path[:(len(orpg_root_path)-len(os.sep))]
146 fn = orpg_root_path + os.sep + "orpg" + os.sep + "dirpath" + os.sep + "approot.py"
147 f = open(fn, "w")
148 #trim off the appended os.sep character(s) to avoid duplicating them on re-loading of path
149 code = 'basedir = "' + orpg_root_path + '"' + "\n"
150 #fix path string for windows boxes that lamely use an escape character for a path separator
151 code = str.replace(code,'\\','\\\\')
152 f.write(code)
153 f.close()
154 except IOError:
155 print "[WARNING] Could not create approot file."
156 print "[WARNING] Automatic directory resolution not configured."
157 return