diff --git a/crates/gitbutler-tauri/.gitignore b/crates/gitbutler-tauri/.gitignore index 635a7fb370..81b42463b8 100644 --- a/crates/gitbutler-tauri/.gitignore +++ b/crates/gitbutler-tauri/.gitignore @@ -3,3 +3,6 @@ gen/ # Extra binaries, figure out why they end up in this directory on build. gitbutler-git-* + +# Injected for Tauri v1 -> v2 upgrade, remove when no longer needed. +./GitButler* \ No newline at end of file diff --git a/crates/gitbutler-tauri/files/relauncher b/crates/gitbutler-tauri/files/relauncher deleted file mode 100755 index 3df632f06d..0000000000 --- a/crates/gitbutler-tauri/files/relauncher +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# This file gets copied into the MacOS bundle, specified in the tauri.conf.json -# configuration under `bundle.macos.files`. It solves the Tauri v1 -> v2 upgrade -# as relaunching the app after an update assumes the binary name to be the same. - -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -$SCRIPT_DIR/gitbutler-tauri diff --git a/crates/gitbutler-tauri/inject-relauncher.sh b/crates/gitbutler-tauri/inject-relauncher.sh index cd5e78109b..a7403e652a 100755 --- a/crates/gitbutler-tauri/inject-relauncher.sh +++ b/crates/gitbutler-tauri/inject-relauncher.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Injects the relauncher into the right place with the correct platform +# information. It is only needed for macos, but there is no way to restrict +# "externalBin" in the turi configuration to a specific platform. set -euo pipefail THIS="$0" @@ -14,7 +17,7 @@ CRATE_ROOT="$ROOT/crates/gitbutler-tauri" log injecting relauncher into crates/gitbutler-tauri "(TRIPLE=${TRIPLE})" if ! [[ $TRIPLE =~ "windows" ]]; then - cp -v "$CRATE_ROOT/files/relauncher" "$CRATE_ROOT/$RELAUNCHER-${TRIPLE}" + cp -v "$CRATE_ROOT/relauncher.sh" "$CRATE_ROOT/$RELAUNCHER-${TRIPLE}" else - cp -v "$CRATE_ROOT/files/relauncher" "$CRATE_ROOT/$RELAUNCHER-${TRIPLE}.exe" + cp -v "$CRATE_ROOT/relauncher.sh" "$CRATE_ROOT/$RELAUNCHER-${TRIPLE}.exe" fi diff --git a/crates/gitbutler-tauri/relauncher.sh b/crates/gitbutler-tauri/relauncher.sh new file mode 100755 index 0000000000..de53f2c6d5 --- /dev/null +++ b/crates/gitbutler-tauri/relauncher.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# This relauncher is necessary for Tauri v1 -> v2 upgrades. The binary name +# has changed from e.g. `GitButler` to `gitbutler-tauri`, but on restarting +# the app the executable is expected to have the same path. This bash script +# is copied into the known location of the old binary name. + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# Line needs to be quoted since $SCRIPT_DIR contains spaces. +"$SCRIPT_DIR/gitbutler-tauri"