mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-05-11 05:55:17 +00:00
Use [ -nt ] instead of stat -f%m to check cache files.
This commit is contained in:
@@ -54,27 +54,14 @@ function in_gradle() {
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################################
|
||||
# Define the stat_cmd command based on platform behavior
|
||||
##########################################################################
|
||||
stat -f%m . > /dev/null 2>&1
|
||||
if [ "$?" = 0 ]; then
|
||||
stat_cmd=(stat -f%m)
|
||||
else
|
||||
stat_cmd=(stat -L --format=%Y)
|
||||
fi
|
||||
|
||||
############################################################################## Examine the build.gradle file to see if its
|
||||
# timestamp has changed, and if so, regen
|
||||
# the .gradle_tasks cache file
|
||||
############################################################################
|
||||
_gradle_does_task_list_need_generating () {
|
||||
if [ ! -f .gradletasknamecache ]; then return 0;
|
||||
else
|
||||
accurate=$($stat_cmd .gradletasknamecache)
|
||||
changed=$($stat_cmd build.gradle)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
[ ! -f .gradletasknamecache ] && return 0;
|
||||
[ .gradletasknamecache -nt build.gradle ] && return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user