Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swiftly installer change default bin to /usr/local/bin #49

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions Sources/SwiftlyCore/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ extension Platform {
///
/// If a mocked home directory is set, this will be the "bin" subdirectory of the home directory.
/// If not, this will be the SWIFTLY_BIN_DIR environment variable if set. If that's also unset,
/// this will default to ~/.local/bin.
/// this will default to /usr/local/bin.
public var swiftlyBinDir: URL {
SwiftlyCore.mockedHomeDir.map { $0.appendingPathComponent("bin", isDirectory: true) }
?? ProcessInfo.processInfo.environment["SWIFTLY_BIN_DIR"].map { URL(fileURLWithPath: $0) }
?? FileManager.default.homeDirectoryForCurrentUser
.appendingPathComponent(".local", isDirectory: true)
.appendingPathComponent("bin", isDirectory: true)
SwiftlyCore.mockedHomeDir.map { $0.appendingPathComponent("bin", isDirectory: true) } ??
ProcessInfo.processInfo.environment["SWIFTLY_BIN_DIR"].map { URL(fileURLWithPath: $0) } ??
URL(fileURLWithPath: "/usr/local/bin")
}

/// The "toolchains" subdirectory of swiftly's home directory. Contains the Swift toolchains managed by swiftly.
Expand Down
4 changes: 2 additions & 2 deletions install/swiftly-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Script used to install and configure swiftly.
#
# This script will download the latest released swiftly executable and install it
# to $SWIFTLY_BIN_DIR, or ~/.local/bin if that variable isn't specified.
# to $SWIFTLY_BIN_DIR, or /usr/local/bin if that variable isn't specified.
#
# This script will also create a directory at $SWIFTLY_HOME_DIR, or
# $XDG_DATA_HOME/swiftly if that variable isn't specified. If XDG_DATA_HOME is also unset,
Expand Down Expand Up @@ -161,7 +161,7 @@ echo ""
DATA_DIR="${XDG_DATA_HOME:-$HOME/.local/share}"
DEFAULT_HOME_DIR="$DATA_DIR/swiftly"
HOME_DIR="${SWIFTLY_HOME_DIR:-$DEFAULT_HOME_DIR}"
DEFAULT_BIN_DIR="$HOME/.local/bin"
DEFAULT_BIN_DIR="/usr/local/bin"
BIN_DIR="${SWIFTLY_BIN_DIR:-$DEFAULT_BIN_DIR}"

while [ -z "$DISABLE_CONFIRMATION" ]; do
Expand Down