Scan parent list for file selecting lowest level matching file
(pFilePath, pDefaultPath, pJoin='\\')
| 43 | import subprocess |
| 44 | |
| 45 | def ParentSearch(pFilePath, pDefaultPath, pJoin='\\'): |
| 46 | ''' |
| 47 | Scan parent list for file selecting lowest level matching file |
| 48 | ''' |
| 49 | lParts = pFilePath.split(pJoin) |
| 50 | lCount = len(lParts) - 1 |
| 51 | lPath = '' |
| 52 | while lCount > 0: |
| 53 | lPath = pJoin.join(lParts[0:lCount]) + pJoin + lParts[-1] |
| 54 | if os.path.exists(lPath): |
| 55 | break |
| 56 | lCount -= 1 |
| 57 | else: |
| 58 | lPath = pDefaultPath |
| 59 | return lPath |
| 60 | |
| 61 | def ExpandArg(pArg, pFilePath, pDefaultPath, pLeft='{', pSep=';', pQuote='"', |
| 62 | pPref='{<-}', pJoin='\\'): |