Skip to content

Commit

Permalink
Check for toolchains with -RELEASE
Browse files Browse the repository at this point in the history
Fixes #68
  • Loading branch information
kylef committed Oct 11, 2016
1 parent bcfe669 commit 331843b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
28 changes: 17 additions & 11 deletions libexec/swiftenv-prefix
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,24 @@ if [ -d "$SWIFTENV_ROOT/versions/swift-$SWIFT_VERSION" ]; then
fi

# OS X Swift Toolchain
TOOLCHAIN_DIR="/Library/Developer/Toolchains"
if [ -d "$TOOLCHAIN_DIR/swift-$SWIFT_VERSION.xctoolchain" ]; then
echo "$TOOLCHAIN_DIR/swift-$SWIFT_VERSION.xctoolchain"
exit
fi

# OS X User Swift Toolchain
TOOLCHAIN_DIR="$HOME/Library/Developer/Toolchains"
if [ -d "$TOOLCHAIN_DIR/swift-$SWIFT_VERSION.xctoolchain" ]; then
echo "$TOOLCHAIN_DIR/swift-$SWIFT_VERSION.xctoolchain"
exit
fi
check_toolchain() {
local TOOLCHAIN_DIR
TOOLCHAIN_DIR=$1

if [ -d "$TOOLCHAIN_DIR/swift-$SWIFT_VERSION-RELEASE.xctoolchain" ]; then
echo "$TOOLCHAIN_DIR/swift-$SWIFT_VERSION-RELEASE.xctoolchain"
exit
fi

if [ -d "$TOOLCHAIN_DIR/swift-$SWIFT_VERSION.xctoolchain" ]; then
echo "$TOOLCHAIN_DIR/swift-$SWIFT_VERSION.xctoolchain"
exit
fi
}

check_toolchain "$HOME/Library/Developer/Toolchains"
check_toolchain "/Library/Developer/Toolchains"

# OS X Xcode Swift's
if command -v "mdfind" >/dev/null 2>&1; then
Expand Down
2 changes: 1 addition & 1 deletion libexec/swiftenv-versions
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ check_toolchains() {
if [[ "$path" == *".xctoolchain" ]] && [ -d "$path" ]; then
version="$(basename ${path##*/} .xctoolchain)"
if [ "$version" != "swift-latest" ]; then
print_version "$version" "toolchain"
print_version "${version%-RELEASE}" "toolchain"
fi
fi
done
Expand Down

0 comments on commit 331843b

Please sign in to comment.