Changeset 254
- Timestamp:
- 06/05/08 13:30:39 (4 years ago)
- Location:
- trunk/fm_gui
- Files:
-
- 1 removed
- 1 modified
-
global.c (deleted)
-
src/global.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fm_gui/src/global.c
r252 r254 1 #include <string.h> 1 2 #include <glib.h> 2 3 #ifdef G_OS_WIN32 … … 13 14 #include "binreloc.h" 14 15 16 #define LIBDIR_SUFFIX ".libs" 17 15 18 16 19 static gchar *prefix; 17 static gchar *exe_path;18 20 static gchar *bin_path; 19 21 //static gchar *lib_path; … … 25 27 { 26 28 GError *err = NULL; 29 gchar *prefix_temp; 27 30 28 31 #ifdef G_OS_WIN32 29 TCHAR path[MAX_PATH];32 TCHAR exe_filename[MAX_PATH]; 30 33 31 GetModuleFileName (NULL, path, MAX_PATH);34 GetModuleFileName (NULL, exe_filename, MAX_PATH); 32 35 33 36 exe_path = g_path_get_dirname (path); 37 g_print ("Executable is %s\n", exe_filename); 38 prefix_temp = g_strdup (prefix_temp); 34 39 #else 40 41 gboolean in_source_dir; 42 35 43 if (gbr_init (&err)) 36 44 g_print("binreloc available!\n"); … … 41 49 if (!exe_filename) 42 50 g_warning ("Can't determine installation prefix!"); 51 else 52 g_print ("Executable is %s\n", exe_filename); 43 53 44 exe_path = g_path_get_dirname (exe_filename); 45 g_free (exe_filename); 54 prefix_temp = g_path_get_dirname (exe_filename); 55 g_print ("prefix_temp %s\n", prefix_temp); 56 gchar *basename = g_path_get_basename (prefix_temp); 57 g_print ("basename %s\n", basename); 58 59 if (strcmp (basename, LIBDIR_SUFFIX) == 0) { 60 g_print ("we are in a libtool temporary directory, adjusting path...\n"); 61 62 prefix_temp = g_strdup (prefix_temp); 63 prefix_temp[strlen (prefix_temp) - strlen (LIBDIR_SUFFIX) - 1] = '\0'; 64 } 65 66 g_free (basename); 67 68 basename = g_path_get_basename (prefix_temp); 69 70 if (strcmp (basename, "src") == 0) 71 in_source_dir = TRUE; 72 else 73 in_source_dir = FALSE; 74 75 prefix_temp[strlen (prefix_temp) - strlen (basename)] = '\0'; 76 77 g_free (basename); 78 79 46 80 #endif 47 81 48 gchar *makefile_name = g_build_filename (exe_path, "Makefile.am", NULL); 49 gchar *data_path_temp = NULL; 50 if (g_file_test (makefile_name, G_FILE_TEST_EXISTS)) { 51 g_print ("%s exists, we are in the source directory\n", makefile_name); 82 g_print ("base path %s --- ", prefix_temp); 83 if (in_source_dir) { 84 g_print ("source directory\n"); 52 85 53 prefix = g_path_get_dirname (exe_path);54 bin_path = g_ strdup (exe_path);86 prefix = g_strdup (prefix_temp); 87 bin_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "src", NULL); 55 88 data_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "data", NULL); 89 56 90 } else { 57 prefix = gbr_find_prefix (PREFIX);91 g_print ("installation directory\n"); 58 92 59 #ifdef G_OS_WIN32 60 bin_path = g_build_path (G_DIR_SEPARATOR_S, path, "bin", NULL); 61 // lib_path = g_build_path (G_DIR_SEPARATOR_S, path, "lib", NULL); 62 data_path_temp = g_build_path (G_DIR_SEPARATOR_S, path, "share", NULL); 63 #else 64 bin_path = gbr_find_lib_dir (PREFIX "/bin"); 65 // lib_path = gbr_find_lib_dir (PREFIX "/lib"); 66 data_path_temp = gbr_find_data_dir (PREFIX "/share/fm_gui"); 67 #endif 68 data_path = g_build_path (G_DIR_SEPARATOR_S, data_path_temp, "fm_gui", NULL); 93 prefix = g_strdup (prefix_temp); 94 bin_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "bin", NULL); 95 data_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "share", PACKAGE, NULL); 96 69 97 } 70 71 72 98 73 g_free ( makefile_name);99 g_free (prefix_temp); 74 100 75 101 g_print ("prefix %s\n", prefix); 76 g_print (" exe_path %s\n", exe_path);102 g_print ("bin_path %s\n", bin_path); 77 103 g_print ("data_path %s\n", data_path); 78 104 }
