(drive,spiNo)
| 28 | import storage |
| 29 | |
| 30 | def sdMount(drive,spiNo): |
| 31 | |
| 32 | def chkPath(tstPath): |
| 33 | validPath = True |
| 34 | |
| 35 | simpPath = "" |
| 36 | if tstPath == []: |
| 37 | validPath = True |
| 38 | simpPath = "" |
| 39 | else: |
| 40 | |
| 41 | savDir = os.getcwd() |
| 42 | |
| 43 | for path in tstPath: |
| 44 | if path == "": |
| 45 | os.chdir("/") |
| 46 | |
| 47 | elif os.getcwd() == "/" and path == "..": |
| 48 | validPath = False |
| 49 | break |
| 50 | |
| 51 | elif path == ".": |
| 52 | continue |
| 53 | |
| 54 | elif path == ".." and len(os.getcwd().split('/')) == 2: |
| 55 | os.chdir('/') |
| 56 | |
| 57 | elif path == "..": |
| 58 | os.chdir("..") |
| 59 | |
| 60 | elif path in os.listdir() and (os.stat(path)[0] & (2**15) == 0): |
| 61 | os.chdir(path) |
| 62 | |
| 63 | else: |
| 64 | validPath = False |
| 65 | simpPath = "" |
| 66 | break |
| 67 | |
| 68 | if validPath: |
| 69 | simpPath = os.getcwd() |
| 70 | os.chdir(savDir) |
| 71 | |
| 72 | return((validPath,simpPath)) |
| 73 | |
| 74 | def absolutePath(argPath,currDir): |
| 75 | |
| 76 | if argPath[0] == '/': |
| 77 | fullPath = argPath |
| 78 | elif currDir == '/': |
| 79 | fullPath = '/'+argPath |
| 80 | else: |
| 81 | fullPath = currDir+'/'+argPath |
| 82 | |
| 83 | if len(fullPath) > 1 and fullPath[-1] == '/': |
| 84 | fullPath = fullPath[:-1] |
| 85 | |
| 86 | return(fullPath) |
| 87 |
no test coverage detected