Merge pull request #296 from patrikha/master

Fixed so that stat file now also works on OSX
This commit is contained in:
nicoulaj 2016-02-04 21:37:12 +01:00
commit 7cc7b92810
1 changed files with 9 additions and 2 deletions

View File

@ -221,6 +221,13 @@ _port_select() {
fi
}
stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then
stat_cmd=(stat -f%Z)
else
stat_cmd=(stat --format=%Z)
fi
_port_caching_policy() {
local reg_time comp_time check_file
case "${1##*/}" in
@ -231,8 +238,8 @@ _port_caching_policy() {
check_file=${$(port dir MacPorts)%/*/*}/PortIndex
;;
esac
reg_time=$(stat -c '%Z' $check_file)
comp_time=$(stat -c '%Z' $1)
reg_time=$($stat_cmd $check_file)
comp_time=$($stat_cmd $1)
return $(( reg_time < comp_time ))
}