MCPcopy Index your code
hub / github.com/RetiredWizard/PyDOS / chkPath

Function chkPath

PyDOS.py:156–186  ·  view source on GitHub ↗
(tstPath)

Source from the content-addressed store, hash-verified

154 return
155
156 def chkPath(tstPath):
157 validPath = True
158 simpPath = ""
159
160 if tstPath != []:
161 savDir = os.getcwd()
162 for path in tstPath:
163 if path[1:2] == ":":
164 path = path[2:]
165 if path == "":
166 os.chdir(sep)
167 elif os.getcwd() == sep and path == "..":
168 validPath = False
169 break
170 elif path == ".":
171 continue
172 elif path == ".." and len(os.getcwd().split(sep)) == 2:
173 os.chdir(sep)
174 elif path == "..":
175 os.chdir("..")
176 elif path in os.listdir() and not aFile(path):
177 os.chdir(path)
178 else:
179 validPath = False
180 break
181
182 if validPath:
183 simpPath = os.getcwd()
184 os.chdir(savDir)
185
186 return((validPath,simpPath))
187
188 def pFmt(dPath,trailsep=True):
189 if dPath == "":

Callers 2

prDirFunction · 0.70
PyDOSFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected