Changeset 252
- Timestamp:
- 06/04/08 21:39:02 (4 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
fm_gui/src/global.c (modified) (4 diffs)
-
fm_server/src/fm_output.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fm_gui/src/global.c
r251 r252 1 #include <string.h>2 1 #include <glib.h> 3 2 #ifdef G_OS_WIN32 … … 14 13 #include "binreloc.h" 15 14 16 #define LIBDIR_SUFFIX ".libs"17 18 15 19 16 static gchar *prefix; 17 static gchar *exe_path; 20 18 static gchar *bin_path; 21 19 //static gchar *lib_path; … … 27 25 { 28 26 GError *err = NULL; 29 gchar *prefix_temp;30 27 31 28 #ifdef G_OS_WIN32 32 TCHAR exe_filename[MAX_PATH];29 TCHAR path[MAX_PATH]; 33 30 34 GetModuleFileName (NULL, exe_filename, MAX_PATH);31 GetModuleFileName (NULL, path, MAX_PATH); 35 32 36 33 exe_path = g_path_get_dirname (path); 37 g_print ("Executable is %s\n", exe_filename);38 prefix_temp = g_strdup (prefix_temp);39 34 #else 40 41 gboolean in_source_dir;42 43 35 if (gbr_init (&err)) 44 36 g_print("binreloc available!\n"); … … 49 41 if (!exe_filename) 50 42 g_warning ("Can't determine installation prefix!"); 51 else52 g_print ("Executable is %s\n", exe_filename);53 43 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); 44 exe_path = g_path_get_dirname (exe_filename); 45 g_free (exe_filename); 46 #endif 58 47 59 if (strcmp (basename, LIBDIR_SUFFIX) == 0) { 60 g_print ("we are in a libtool temporary directory, adjusting path...\n"); 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); 61 52 62 prefix_temp = g_strdup (prefix_temp); 63 prefix_temp[strlen (prefix_temp) - strlen (LIBDIR_SUFFIX) - 1] = '\0'; 53 prefix = g_path_get_dirname (exe_path); 54 bin_path = g_strdup (exe_path); 55 data_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "data", NULL); 56 } else { 57 prefix = gbr_find_prefix (PREFIX); 58 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); 64 69 } 65 70 66 g_free (basename);67 71 68 basename = g_path_get_basename (prefix_temp);69 70 if (strcmp (basename, "src") == 0)71 in_source_dir = TRUE;72 else73 in_source_dir = FALSE;74 75 prefix_temp[strlen (prefix_temp) - strlen (basename)] = '\0';76 77 g_free (basename);78 79 80 #endif81 82 g_print ("base path %s --- ", prefix_temp);83 if (in_source_dir) {84 g_print ("source directory\n");85 86 prefix = g_strdup (prefix_temp);87 bin_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "src", NULL);88 data_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "data", NULL);89 90 } else {91 g_print ("installation directory\n");92 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 97 }98 72 99 g_free ( prefix_temp);73 g_free (makefile_name); 100 74 101 75 g_print ("prefix %s\n", prefix); 102 g_print (" bin_path %s\n", bin_path);76 g_print ("exe_path %s\n", exe_path); 103 77 g_print ("data_path %s\n", data_path); 104 78 } -
trunk/fm_server/src/fm_output.c
r250 r252 108 108 fm_output_start (FmOutput *output) 109 109 { 110 FmOutputClass *klass = FM_OUTPUT_GET_CLASS (output); 111 FmElement *element = FM_ELEMENT (output); 112 113 if (!element->active) { 114 g_warning ("element \"%s\" is not active, cancel start!", 115 fm_element_get_name (FM_ELEMENT (output))); 116 return FALSE; 117 } 118 119 if (klass->start) 120 return (*klass->start) (output); 110 FmOutputClass *class = FM_OUTPUT_GET_CLASS(output); 111 112 if (class->start) 113 return (*class->start)(output); 121 114 else { 122 115 g_warning ("\"start\" method not defined for element \"%s\"!", 123 fm_element_get_name (FM_ELEMENT(output)));116 fm_element_get_name(FM_ELEMENT(output))); 124 117 return FALSE; 125 118 } … … 130 123 fm_output_stop (FmOutput *output) 131 124 { 132 FmOutputClass *klass = FM_OUTPUT_GET_CLASS (output); 133 FmElement *element = FM_ELEMENT (output); 134 135 if (!element->active) { 136 g_warning ("element \"%s\" is not active, cancel start!", 137 fm_element_get_name (FM_ELEMENT (output))); 138 return FALSE; 139 } 125 FmOutputClass *class = FM_OUTPUT_GET_CLASS(output); 140 126 141 if ( klass->stop)142 return (* klass->stop)(output);127 if (class->stop) 128 return (*class->stop)(output); 143 129 else { 144 130 g_warning ("\"stop\" method not defined for element \"%s\"!", 145 fm_element_get_name (FM_ELEMENT(output)));131 fm_element_get_name(FM_ELEMENT(output))); 146 132 return FALSE; 147 133 }
