f-spot r4527 - in trunk: . src src/Core



Author: sdelcroix
Date: Mon Oct 20 12:31:49 2008
New Revision: 4527
URL: http://svn.gnome.org/viewvc/f-spot?rev=4527&view=rev

Log:
2008-10-20  Stephane Delcroix  <sdelcroix novell com>

	* src/Core/Global.cs: use $XDG_CONFIG_HOME/f-spot as data storage path
	instead of ~/.gnome2/f-spot

	* src/f-spot.in: mv ~/.gnome2/f-spot to .config or fails if both exists

Modified:
   trunk/ChangeLog
   trunk/src/Core/Global.cs
   trunk/src/f-spot.in

Modified: trunk/src/Core/Global.cs
==============================================================================
--- trunk/src/Core/Global.cs	(original)
+++ trunk/src/Core/Global.cs	Mon Oct 20 12:31:49 2008
@@ -4,6 +4,7 @@
  * This is free software. See COPYING for details
  *
  */
+using System;
 
 namespace FSpot {
 	public static class Global {
@@ -11,7 +12,9 @@
 			get { return System.IO.Path.Combine (System.Environment.GetEnvironmentVariable ("HOME"), System.String.Empty); }
 		}
 		
-		private static string base_dir = System.IO.Path.Combine (HomeDirectory,  System.IO.Path.Combine (".gnome2", "f-spot"));
+		//$XDG_CONFIG_HOME/f-spot or $HOME/.config/f-spot
+		private static string xdg_config_home = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
+		private static string base_dir = System.IO.Path.Combine (xdg_config_home, "f-spot");
 		public static string BaseDirectory {
 			get { return base_dir; }
 			set { base_dir = value; }

Modified: trunk/src/f-spot.in
==============================================================================
--- trunk/src/f-spot.in	(original)
+++ trunk/src/f-spot.in	Mon Oct 20 12:31:49 2008
@@ -29,6 +29,7 @@
 run_mdb=false
 run_gdb=false
 run_valgrind=false
+basedir_set=false
 for arg in "$@"; do
     case "x$arg" in
     	x--debug)
@@ -40,6 +41,9 @@
 	x--gdb)
 	    run_gdb=true
 	    ;;
+	x-b) basedir_set=true;;
+	x-basedir) basedir_set=true;;
+	x--basedir) basedir_set=true;;
 	x--valgrind)
 	    run_valgrind=true
 	    ;;
@@ -57,6 +61,21 @@
     esac
 done
 
+if [ "$basedir_set" != "true" ]; then
+    if [ ! -n "$XDG_CONFIG_HOME" ]; then
+        XDG_CONFIG_HOME="$HOME/.config"
+    fi
+    if [ -e "$HOME/.gnome2/f-spot" ] && [ -e "$XDG_CONFIG_HOME/f-spot" ]; then
+        echo "It looks like you have 2 settings directories for f-spot ($HOME/.gnome2/f-spot and $XDG_CONFIG_HOME/f-spot). Remove one or run f-spot with --basedir option"
+        zenity --error --text="It looks like you have 2 settings directories for f-spot ($HOME/.gnome2/f-spot and $XDG_CONFIG_HOME/f-spot). Remove one or run f-spot with --basedir option"
+	exit -1
+    elif [ -e "$HOME/.gnome2/f-spot" ]; then
+        mkdir -p $XDG_CONFIG_HOME/
+	echo "Moving $HOME/.gnome2/f-spot to $XDG_CONFIG_HOME/"
+        mv $HOME/.gnome2/f-spot $XDG_CONFIG_HOME/
+    fi
+fi
+
 if [ -n "$FSPOT_DEBUG" ]; then
     echo "** Running f-spot in Debug Mode **"
 fi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]