Exemplo n.º 1
0
def findResources(s, **kw):
    '''A wildcard in a {$R *.res} or {$R *.dfm} directive is not a wildcard,
    is not matched with a glob, it only means Form.dfm if found in Form.pas'''
    # XXX the context of files found as resources is not kept, which makes
    # file extensions that do not map to known resources (.res, .frm) become
    # classified as Unknown filetype
    ress = finders.find_resources(s)
    for (i, res) in enumerate(ress):
        res = io.convert_path(res)
        path, filename = os.path.split(res)
        stem, ext = os.path.splitext(filename)
        if stem == '*':
            par, _ = os.path.splitext(kw['parent'].filename)
            stem = par
            ress[i] = os.path.join(path, stem + ext)
    return ress
Exemplo n.º 2
0
def process_filepaths(curpath, unitaliases, fps):
    # resolve unit aliases
    nfps = []
    for fp in fps:
        stem, ext = os.path.splitext(fp)
        stem = stem.lower()
        if ext in ('.pas', '.dcu') and stem in unitaliases:
            nfps.append(unitaliases[stem] + ext)
        else:
            nfps.append(fp)
    fps = util.uniq(nfps)

    fps = [io.convert_path(fp) for fp in fps]
    fps = map(lambda f: os.path.join(curpath, f), fps)
    fps = map(lambda f: os.path.normpath(f), fps)
    fps = io.iglobs(fps)
    fps = util.uniq(fps)
    return fps
Exemplo n.º 3
0
 def _prepare_path(self, fp):
     if io.platform_is_cygwin():
         fp = io.convert_path(fp)
     fp = fp.lower()
     return fp