Skip to content

Commit b2de038

Browse files
author
pengdong
committed
ADD: 修复 readlink -f 问题
1 parent 946fcce commit b2de038

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

lib/cocoapods-ppbuild/Integration.rb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -364,19 +364,17 @@ class EmbedFrameworksScript
364364
script = old_method.bind(self).()
365365
if not Pod::is_prebuild_stage
366366
patch = <<-SH.strip_heredoc
367-
#!/bin/sh
368-
369367
# ---- this is added by cocoapods-ppbuild ---
370-
# Readlink cannot handle relative symlink well, so we override it to a new one
371-
# If the path isn't an absolute path, we add a realtive prefix.
372-
old_read_link=`which readlink`
368+
# If -f appears anywhere, path is the last arg (handles readlink -f path, readlink -f -n path, readlink -n -f path).
373369
readlink () {
374-
path=`$old_read_link "$1"`;
375-
if [ $(echo "$path" | cut -c 1-1) = '/' ]; then
376-
echo $path;
377-
else
378-
echo "`dirname $1`/$path";
379-
fi
370+
for _r_arg in "\$@"; do
371+
if [ "\$_r_arg" = "-f" ]; then
372+
for _r_arg in "\$@"; do _r_path="\$_r_arg"; done
373+
[ -n "\$_r_path" ] && ruby -e "puts File.realpath(ARGV[0])" "\$_r_path"
374+
return
375+
fi
376+
done
377+
/usr/bin/readlink "\$@"
380378
}
381379
# ---
382380
SH
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module CocoapodsPpbuild
2-
VERSION = "1.1.1"
2+
VERSION = "1.1.2"
33
end

0 commit comments

Comments
 (0)