[banshee] [osx] store bundle path, relocate once, spaceguard
- From: Aaron Bockover <abock src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee] [osx] store bundle path, relocate once, spaceguard
- Date: Tue, 19 Jan 2010 22:14:40 +0000 (UTC)
commit cae3c20ff916e769e919019da3b3bcd26c5e71f2
Author: Aaron Bockover <abockover novell com>
Date: Tue Jan 19 17:11:09 2010 -0500
[osx] store bundle path, relocate once, spaceguard
Only generate config files that need absolute paths when it is
detected that the bundle location has changed. Store the bundle
location in ~/.config/banshee-1/app-bundle-location. Additionally
remove the Mono Addins databases when we are relocated.
Finally, until a better work around for Pango modules is found,
the bundle path cannot have any spaces in it, since the resulting
absolute path as written to pango.modules will contain a space,
and pango will not properly parse this, so no modules will load
and Banshee will not be able to render any text.
If a space is detected in the bundle path, show a lame dialog
telling the user how lame this is.
src/Clients/Booter/banshee-1.darwin.in | 45 +++++++++++++++++++++++++++----
1 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/src/Clients/Booter/banshee-1.darwin.in b/src/Clients/Booter/banshee-1.darwin.in
index c1265b1..085a6ec 100644
--- a/src/Clients/Booter/banshee-1.darwin.in
+++ b/src/Clients/Booter/banshee-1.darwin.in
@@ -2,6 +2,7 @@
APP_ROOT="$PWD/$(dirname "$0")"
for ((i=0; i<2; i++)); do APP_ROOT="$(dirname "$APP_ROOT")"; done
+APP_ROOT="${APP_ROOT/\/\/}"
# Bundle directories
CONTENTS_DIR="$APP_ROOT/Contents"
@@ -42,10 +43,42 @@ for arg in $*; do
fi
done
-for file in $(find $ETC_DIR -name \*.in); do
- sed "s|\${APP_RESOURCES}|${RES_DIR}|g" \
- < "${file}" \
- > "${file%.in}"
-done
+# FIXME
+# pango.modules sucks - it doesn't like paths with spaces,
+# so even though everything else works fine, we still
+# will explode, so instead I'm just showing this lame dialog.
+if [[ "$APP_ROOT" =~ [[:space:]] ]]; then
+ osascript &>/dev/null <<EOF
+ tell application "System Events"
+ activate
+ display dialog "A space was detected in the path to Banshee. Currently this is unsupported.\n\nRename or move Banshee.app to a path without spaces.\n\nPath: $APP_ROOT" with title "Error" with icon caution buttons { "OK" } default button 1
+ end tell
+EOF
+ exit 1
+fi
+
+mkdir -p "$BANSHEE_CONFIG_DIR"
+PREVIOUS_APP_ROOT="$(cat "$BANSHEE_CONFIG_DIR/app-bundle-location" 2>/dev/null)"
+if [ ! "$APP_ROOT" = "$PREVIOUS_APP_ROOT" ]; then
+ echo "Application bundle has moved. Adjusting bundle..."
+
+ # Mono Addins doesn't like being relocated - its cache contains
+ # references to the previous location of this bundle
+ find "$BANSHEE_CONFIG_DIR" -name addin-db-\* \
+ -exec rm -rf -- {} \; &>/dev/null
+
+ # Adjust config files that need absolute paths to things
+ # in the bundle (e.g. pango, GDK pixbuf loaders...)
+ IFS=$'\n'
+ for file in $(find "$ETC_DIR" -name \*.in); do
+ sed "s|\${APP_RESOURCES}|${RES_DIR}|g" \
+ < "${file}" \
+ > "${file%.in}"
+ done
+ unset IFS
+
+ # Store the new location of the bundle
+ echo "$APP_ROOT" > "$BANSHEE_CONFIG_DIR/app-bundle-location"
+fi
-exec -a $BANSHEE_EXEC_NAME $MONO_BIN $MONO_OPTIONS $MONO_EXE $BANSHEE_OPTIONS
+exec -a $BANSHEE_EXEC_NAME "$MONO_BIN" $MONO_OPTIONS "$MONO_EXE" $BANSHEE_OPTIONS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]