Replace all {?} macros in pCommand
(pCommand, pFilePath, pSep='\\')
| 52 | import subprocess |
| 53 | |
| 54 | def Expand(pCommand, pFilePath, pSep='\\'): |
| 55 | 'Replace all {?} macros in pCommand' |
| 56 | # Split file path into parts |
| 57 | if len(pFilePath) > 0: |
| 58 | lFilePath = os.path.abspath(pFilePath) |
| 59 | lEndPos = lFilePath.rfind(pSep) |
| 60 | lPath = lFilePath[0:lEndPos] |
| 61 | lFileName = lFilePath[lEndPos+1:] |
| 62 | lEndPos = lFileName.rfind(".") |
| 63 | lName = lFileName[:lEndPos] |
| 64 | lFilePart = lPath + pSep + lName |
| 65 | lExtension = lFileName[lEndPos+1:] |
| 66 | lPathParts = lFilePath.split(pSep) |
| 67 | else: |
| 68 | lFilePath = lPath=lFileName=lName=lFilePart=lExtension="" |
| 69 | lPathParts = [] |
| 70 | |
| 71 | lParts = pCommand.split('{') |
| 72 | if len(lParts) == 1: # no replacements |
| 73 | lCommand = pCommand |
| 74 | else: # scan and replace |
| 75 | commands |
| 76 | lCommand = lParts[0] |
| 77 | for lPart in lParts[1:]: # for each |
no test coverage detected