Changeset 53949


Ignore:
Timestamp:
Jul 17, 2009, 12:31:14 AM (10 years ago)
Author:
blb@…
Message:

Use "string trimright" instead of the manual method; use a safe regsub and comment what is going on better

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/images-and-archives/base/src/port1.0/portimagefile.tcl

    r53884 r53949  
    117117# destroot, which matches that information which is found in receipts.
    118118proc portimagefile::filelist_for_path {startpath} {
    119     if {[string index $startpath end] == "/"} {
    120         set startpath [string range $startpath 0 end-1]
    121     }
     119    set startpath [string trimright $startpath /]
    122120    set filelist {}
    123121    fs-traverse element $startpath {
     
    127125            # out that path to get to what will be the final install path
    128126            set fileinfo [registry_fileinfo_for_file $element]
    129             lappend filelist [regsub -all "^$startpath" $fileinfo ""]
     127
     128            # Note that we don't anchor $startpath since it will occur
     129            # twice in $fileinfo.
     130            # Also, there is a theoretical possiblity that $startpath
     131            # will occur a second time in the full path, but
     132            # the likelihood is very, very, very small. eg, how often
     133            # will /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_<category>_<portname>/work/destroot
     134            # appear in a path besides what MacPorts uses (or its equivalent)?
     135            lappend filelist [regsub -all "(?q)$startpath" $fileinfo ""]
    130136        }
    131137    }
Note: See TracChangeset for help on using the changeset viewer.