From fe7134e94b195a8c9024ca532f7c2893198e0f13 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Tue, 3 Jul 2012 01:09:52 +0200 Subject: [PATCH] Added conditional stat to cake plugin to work cross-platform --- plugins/cake/cake.plugin.zsh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh index 1d0d196ee..5638c6206 100644 --- a/plugins/cake/cake.plugin.zsh +++ b/plugins/cake/cake.plugin.zsh @@ -1,3 +1,9 @@ +stat -f%m . > /dev/null 2>&1 +if [ "$?" = 0 ]; then + stat_cmd=(stat -f%m) +else + stat_cmd=(stat -L --format=%y) +fi # Set this to 1 if you want to cache the tasks _cake_cache_task_list=1 @@ -16,8 +22,8 @@ _cake_does_target_list_need_generating () { if [ ! -f ${_cake_task_cache_file} ]; then return 0; else - accurate=$(stat -f%m $_cake_task_cache_file) - changed=$(stat -f%m Cakefile) + accurate=$($stat_cmd $_cake_task_cache_file) + changed=$($stat_cmd Cakefile) return $(expr $accurate '>=' $changed) fi } @@ -33,4 +39,4 @@ _cake () { fi } -compdef _cake cake \ No newline at end of file +compdef _cake cake