Seif Lotfy has proposed merging lp:~zeitgeist/zeitgeist/bluebird_basedir_2 into 
lp:~zeitgeist/zeitgeist/bluebird.

Requested reviews:
  Zeitgeist Framework Team (zeitgeist)

For more details, see:
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird_basedir_2/+merge/69670

Another take on the constants
DONT MERGE BEFORE TELLING ME
-- 
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird_basedir_2/+merge/69670
Your team Zeitgeist Framework Team is requested to review the proposed merge of 
lp:~zeitgeist/zeitgeist/bluebird_basedir_2 into 
lp:~zeitgeist/zeitgeist/bluebird.
=== modified file 'src/constants.vala'
--- src/constants.vala	2011-07-28 14:39:52 +0000
+++ src/constants.vala	2011-07-28 15:46:35 +0000
@@ -24,13 +24,11 @@
 {
     namespace Constants
     {
-        public static string BASE_DIRECTORY;
         public static string DATA_PATH;
-
         // Directories
-        public const string DATABASE_FILE = "";
-        public const string DATABASE_FILE_BACKUP = "";
-        public const string DEFAULT_LOG_PATH = "";
+        public static string DATABASE_FILE_PATH;
+        public static string DATABASE_FILE_BACKUP_PATH;
+        public static string DEFAULT_LOG_PATH;
 
         // D-Bus
         public const string DBUS_INTERFACE = "";
@@ -47,20 +45,38 @@
         public const uint CACHE_SIZE = 0;
 
         public const string ZEITGEIST_DATA_FOLDER = "bluebird";
-        public const string ZEITGEIST_DATABASE_FILENAME = "activity.sqlite";
 
         public void initialize ()
         {
-            // FIXME: append "/zeitgeist"
-            BASE_DIRECTORY = Path.build_filename(Environment.get_user_data_dir (), ZEITGEIST_DATA_FOLDER);
-            // If directory does not exist create directory
-            if (!FileUtils.test (BASE_DIRECTORY, FileTest.IS_DIR)){
-                 DirUtils.create (BASE_DIRECTORY, 0755);
-            }
+            // Get the value of the ZEITGEIST_DATA_PATH environment variable. 
+            // If it isn't set, then set it tothe value of XDG Data Path + /zeitgeist/
+            // but first makes sure the directory exists
             DATA_PATH = Environment.get_variable ("ZEITGEIST_DATA_PATH");
-            
-            stdout.printf("BASE_DIRECTORY = %s\n", BASE_DIRECTORY);
+            if (DATA_PATH == null)
+            {
+                DATA_PATH = Path.build_filename (Environment.get_user_data_dir (), ZEITGEIST_DATA_FOLDER);
+                // If directory does not exist create directory
+                if (!FileUtils.test (DATA_PATH , FileTest.IS_DIR)){
+                     DirUtils.create (DATA_PATH , 0755);
+                }
+            }
             stdout.printf("DATA_PATH = %s\n", DATA_PATH);
+            
+            
+            DATABASE_FILE_PATH = Environment.get_variable ("ZEITGEIST_DATABASE_PATH");
+            if (DATABASE_FILE_PATH == null)
+            {
+                DATABASE_FILE_PATH = Path.build_filename (DATA_PATH, "activity.sqlite");
+            }
+            stdout.printf("DATABASE_FILE_PATH = %s\n", DATABASE_FILE_PATH);
+            
+            
+            DATABASE_FILE_BACKUP_PATH = Environment.get_variable ("ZEITGEIST_DATABASE_BACKUP_PATH");
+            if (DATABASE_FILE_BACKUP_PATH == null)
+            {
+                DATABASE_FILE_BACKUP_PATH =Path.build_filename (DATA_PATH, "activity.sqlite.bck");
+            }
+            stdout.printf("DATABASE_FILE_BACKUP_PATH = %s\n", DATABASE_FILE_BACKUP_PATH);
         }
     }
 }

=== modified file 'src/sql.vala'
--- src/sql.vala	2011-07-28 14:53:35 +0000
+++ src/sql.vala	2011-07-28 15:46:35 +0000
@@ -60,10 +60,7 @@
     public ZeitgeistDatabase () throws EngineError
     {
         // FIXME: move this out of here
-        string xdg_home_dir = Environment.get_user_data_dir();
-        string sqlite_filepath = Path.build_filename(xdg_home_dir,
-            Constants.ZEITGEIST_DATA_FOLDER,
-            Constants.ZEITGEIST_DATABASE_FILENAME);
+        string sqlite_filepath = Constants.DATABASE_FILE_PATH;
         
         int rc = Database.open_v2(
             sqlite_filepath,

=== modified file 'src/zeitgeist-daemon.vala'
--- src/zeitgeist-daemon.vala	2011-07-28 00:48:23 +0000
+++ src/zeitgeist-daemon.vala	2011-07-28 15:46:35 +0000
@@ -194,6 +194,7 @@
     static int main (string[] args)
     {
         Zeitgeist.Constants.initialize ();
+        //Zeitgeist.Constants.BASE_DIRECTORY = "";
         run ();
         return 0;
     }

_______________________________________________
Mailing list: https://launchpad.net/~zeitgeist
Post to     : zeitgeist@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zeitgeist
More help   : https://help.launchpad.net/ListHelp

Reply via email to