# HG changeset patch
# User Sean Farley <sean@mcs.anl.gov>
# Date 1340403602 18000
# Node ID e4006d582ebd359a125a3b512e40e086e5dfde1a
# Parent 80a5bfe7474dfcedb25231776997b6f95bceff7e
base: loop through sources before returning the default path in macports::getportresourcepath
diff --git a/base/src/macports1.0/macports.tcl b/base/src/macports1.0/macports.tcl
a
|
b
|
|
1505 | 1505 | # @param url port url |
1506 | 1506 | # @param path path in _resources we are interested in |
1507 | 1507 | # @param fallback fall back to the default source tree |
1508 | 1508 | # @return path to the _resources directory or the path to the fallback |
1509 | 1509 | proc macports::getportresourcepath {url {path ""} {fallback yes}} { |
1510 | | global macports::sources_default |
| 1510 | global macports::sources_default macports::sources |
1511 | 1511 | |
1512 | 1512 | set protocol [getprotocol $url] |
1513 | 1513 | |
1514 | 1514 | switch -- ${protocol} { |
1515 | 1515 | file { |
… |
… |
|
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | # append requested path |
1524 | 1524 | set proposedpath [file join $proposedpath _resources $path] |
1525 | 1525 | |
| 1526 | set oldpath $proposedpath |
| 1527 | if {![file exists $proposedpath]} { |
| 1528 | foreach source $sources { |
| 1529 | set protocol [getprotocol $source] |
| 1530 | |
| 1531 | switch -- ${protocol} { |
| 1532 | file { |
| 1533 | set proposedpath [file normalize [file join [getportdir $source]]] |
| 1534 | } |
| 1535 | default { |
| 1536 | set proposedpath [getsourcepath $source] |
| 1537 | } |
| 1538 | } |
| 1539 | |
| 1540 | # append requested path |
| 1541 | set proposedpath [file join $proposedpath _resources $path] |
| 1542 | if {[file exists $proposedpath]} { |
| 1543 | return $proposedpath |
| 1544 | } |
| 1545 | } |
| 1546 | } |
| 1547 | |
1526 | 1548 | if {$fallback == "yes" && ![file exists $proposedpath]} { |
1527 | 1549 | return [getdefaultportresourcepath $path] |
1528 | 1550 | } |
1529 | 1551 | |
1530 | | return $proposedpath |
| 1552 | # if we got here return the original path |
| 1553 | return $oldpath |
1531 | 1554 | } |
1532 | 1555 | |
1533 | 1556 | ## |
1534 | 1557 | # Get the path to the _resources directory of the default source |
1535 | 1558 | # |