| 20 | # fileview.viewFile("filename.txt",(height,width)) |
| 21 | |
| 22 | def chkPath(tstPath): |
| 23 | validPath = True |
| 24 | simpPath = "" |
| 25 | |
| 26 | if tstPath != []: |
| 27 | savDir = os.getcwd() |
| 28 | |
| 29 | for path in tstPath: |
| 30 | if path == "": |
| 31 | os.chdir("/") |
| 32 | elif os.getcwd() == "/" and path == "..": |
| 33 | validPath = False |
| 34 | break |
| 35 | elif path == ".": |
| 36 | continue |
| 37 | elif path == ".." and len(os.getcwd().split('/')) == 2: |
| 38 | os.chdir('/') |
| 39 | elif path == "..": |
| 40 | os.chdir("..") |
| 41 | elif path in os.listdir() and (os.stat(path)[0] & (2**15) == 0): |
| 42 | os.chdir(path) |
| 43 | else: |
| 44 | validPath = False |
| 45 | simpPath = "" |
| 46 | break |
| 47 | |
| 48 | if validPath: |
| 49 | simpPath = os.getcwd() |
| 50 | os.chdir(savDir) |
| 51 | |
| 52 | return((validPath,simpPath)) |
| 53 | |
| 54 | def absolutePath(argPath,currDir): |
| 55 | |