@@ -72,6 +72,7 @@ if [[ "$MACOS_VERSION" -lt 15 ]]; then
7272fi
7373
7474# Check for existing installation
75+ REINSTALL=false
7576if [[ -f " $INSTALL_PATH " ]]; then
7677 EXISTING_VERSION=$( " $INSTALL_PATH " --version 2> /dev/null || echo " unknown" )
7778 warn " Existing installation found: $EXISTING_VERSION "
@@ -85,6 +86,7 @@ if [[ -f "$INSTALL_PATH" ]]; then
8586 else
8687 info " Reinstalling (--yes flag)..."
8788 fi
89+ REINSTALL=true
8890fi
8991
9092# Create temp directory
@@ -127,15 +129,20 @@ build_from_source() {
127129 info " Found: $( swift --version 2>&1 | head -1) "
128130
129131 info " Cloning repository..."
130- git clone --depth 1 " https://github.com/${REPO} .git" " $TEMP_DIR /cupertino" 2>&1 | tail -1
132+ git clone --depth 1 " https://github.com/${REPO} .git" " $TEMP_DIR /cupertino-src " 2>&1 | tail -1
131133
132134 info " Building from source (this may take 1-2 minutes)..."
133- cd " $TEMP_DIR /cupertino/Packages"
135+ cd " $TEMP_DIR /cupertino-src /Packages"
134136 swift build -c release 2>&1 | grep -E " (Build complete|Compiling|Linking|error:)" | tail -5
135137
136138 if [[ -f " .build/release/cupertino" ]]; then
137- cp " .build/release/cupertino" " $TEMP_DIR /cupertino-bin"
138- mv " $TEMP_DIR /cupertino-bin" " $TEMP_DIR /cupertino"
139+ cp " .build/release/cupertino" " $TEMP_DIR /cupertino"
140+ # Copy resource bundle
141+ if [[ -d " .build/arm64-apple-macosx/release/Cupertino_Resources.bundle" ]]; then
142+ cp -R " .build/arm64-apple-macosx/release/Cupertino_Resources.bundle" " $TEMP_DIR /"
143+ elif [[ -d " .build/x86_64-apple-macosx/release/Cupertino_Resources.bundle" ]]; then
144+ cp -R " .build/x86_64-apple-macosx/release/Cupertino_Resources.bundle" " $TEMP_DIR /"
145+ fi
139146 return 0
140147 fi
141148 return 1
@@ -158,6 +165,11 @@ sudo mkdir -p /usr/local/bin
158165sudo ditto " $TEMP_DIR /cupertino" " $INSTALL_PATH "
159166sudo chmod +x " $INSTALL_PATH "
160167
168+ # Install resource bundle if present
169+ if [[ -d " $TEMP_DIR /Cupertino_Resources.bundle" ]]; then
170+ sudo ditto " $TEMP_DIR /Cupertino_Resources.bundle" " /usr/local/bin/Cupertino_Resources.bundle"
171+ fi
172+
161173# Verify installation
162174if ! command -v cupertino & > /dev/null; then
163175 warn " /usr/local/bin may not be in your PATH"
@@ -170,7 +182,11 @@ success "Installed: cupertino $VERSION"
170182# Download databases
171183echo " "
172184info " Downloading documentation databases (~230 MB)..."
173- cupertino setup
185+ if [[ " $REINSTALL " == " true" ]]; then
186+ cupertino setup --force
187+ else
188+ cupertino setup
189+ fi
174190
175191# Done!
176192echo " "
0 commit comments