diff --git a/libexec/relax-export b/libexec/relax-export index 05f6dfa..6d1b2e8 100755 --- a/libexec/relax-export +++ b/libexec/relax-export @@ -106,9 +106,7 @@ export_archive () { --embed "PROVISIONING_PROFILE=$mobileprovision" >/dev/null fi - local ipa_path=$(find "$export_path" -maxdepth 1 -mindepth 1 -name "*.ipa" -print0 \ - | xargs -0 stat -f"%m %N" | sort -rn \ - | head -1 | cut -d" " -f 2-) + local ipa_path="$(read_path $distribution ipa)" if [[ ! -n $ipa_path ]]; then die "Not found IPA file in $export_path" else diff --git a/libexec/util-build b/libexec/util-build index 9eb4376..11a0453 100644 --- a/libexec/util-build +++ b/libexec/util-build @@ -30,13 +30,17 @@ read_path () { local path="" case $type in ipa) - path="$(find "$data_root" -depth 1 -name "*.ipa")" + path="$(find "$data_root" -maxdepth 1 -mindepth 1 -name "*.ipa" -print0 \ + | xargs -0 stat -f"%m %N" | sort -rn \ + | head -1 | cut -d" " -f 2-)" ;; build) path=$data_root ;; archive) - path="$(find "$data_root" -name "*.xcarchive" -depth 1)" + path="$(find "$data_root" -maxdepth 1 -mindepth 1 -name "*.xcarchive" -print0 \ + | xargs -0 stat -f"%m %N" | sort -rn \ + | head -1 | cut -d" " -f 2-)" ;; esac @@ -450,11 +454,12 @@ teardown_build () { __kill_bg_xcodebuid_task if [[ -d "$SRCROOT" ]]; then + find "${SRCROOT}" -name "*.${REL_BAK_EXT}" | \ while read bak do cp "$bak" "${bak%.$REL_BAK_EXT}" rm "$bak" - done < <(find "${SRCROOT}" -name "*.${REL_BAK_EXT}") + done fi set -u }