Index: beagle-util.c
===================================================================
--- beagle-util.c	(revision 3600)
+++ beagle-util.c	(working copy)
@@ -62,7 +62,7 @@
 {
 	const gchar *beagle_home;
 	const gchar *beagle_storage_dir;
-	gchar *socket_dir;
+	gchar *socket_dir; /* this is same as remote_storage_dir in PathFinder.cs */
 	gchar *socket_path;
 	struct stat buf;
 	
@@ -79,26 +79,27 @@
 		/* Finally, beagle home is home dir */
 		if (beagle_home == NULL)
 			beagle_home = g_get_home_dir ();
+
+		/* Construct beagle storage dir */
+		beagle_storage_dir = g_build_filename (beagle_home, ".beagle", NULL);
 	}
 
-	if (beagle_storage_dir != NULL) {
-		socket_dir = g_build_filename (beagle_storage_dir, NULL);
-	} else if (! beagle_util_is_path_on_block_device (beagle_home) ||
+	if (! beagle_util_is_path_on_block_device (beagle_home) ||
 	    getenv ("BEAGLE_SYNCHRONIZE_LOCALLY") != NULL) {
-		gchar *remote_storage_dir = g_build_filename (beagle_home, ".beagle", "remote_storage_dir", NULL);
+		gchar *remote_storage_dir_location_file = g_build_filename (beagle_storage_dir, "remote_storage_dir", NULL);
 		gchar *tmp;
 
-		if (! g_file_test (remote_storage_dir, G_FILE_TEST_EXISTS)) {
-			g_free (remote_storage_dir);
+		if (! g_file_test (remote_storage_dir_location_file, G_FILE_TEST_EXISTS)) {
+			g_free (remote_storage_dir_location_file);
 			return NULL;
 		}
 
-		if (! g_file_get_contents (remote_storage_dir, &socket_dir, NULL, NULL)) {
-			g_free (remote_storage_dir);
+		if (! g_file_get_contents (remote_storage_dir_location_file, &socket_dir, NULL, NULL)) {
+			g_free (remote_storage_dir_location_file);
 			return NULL;
 		}
 
-		g_free (remote_storage_dir);
+		g_free (remote_storage_dir_location_file);
 
 		/* There's a newline at the end that we want to strip off */
 		tmp = strrchr (socket_dir, '\n');
@@ -110,7 +111,7 @@
 			return NULL;
 		}
 	} else {
-		socket_dir = g_build_filename (beagle_home, ".beagle", NULL);
+		socket_dir = g_build_filename (beagle_storage_dir, NULL);
 	}
 
 	socket_path = g_build_filename (socket_dir, client_name, NULL);
