MCPcopy Create free account
hub / github.com/ActiveState/code / ParentSearch

Function ParentSearch

recipes/Python/577440_extensiDopy__Win32/recipe-577440.py:45–59  ·  view source on GitHub ↗

Scan parent list for file selecting lowest level matching file

(pFilePath, pDefaultPath, pJoin='\\')

Source from the content-addressed store, hash-verified

43import subprocess
44
45def 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
61def ExpandArg(pArg, pFilePath, pDefaultPath, pLeft='{', pSep=';', pQuote='"',
62 pPref='{<-}', pJoin='\\'):

Callers 1

ExpandArgFunction · 0.85

Calls 3

splitMethod · 0.45
joinMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected