3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU Lesser General Public License as published by
5 * the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * You should have received a copy of the GNU Lesser General Public License
13 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Tor Lillqvist <tml@novell.com>
19 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
32 /* localedir uses system codepage as it is passed to the non-UTF8ified
35 static const gchar
*localedir
= NULL
;
37 /* The others are in UTF-8 */
38 static const gchar
*bindir
;
39 static const gchar
*datadir
;
40 static const gchar
*ecpsdir
;
41 static const gchar
*etspecdir
;
42 static const gchar
*galviewsdir
;
43 static const gchar
*helpdir
;
44 static const gchar
*icondir
;
45 static const gchar
*imagesdir
;
46 static const gchar
*libdir
;
47 static const gchar
*libexecdir
;
48 static const gchar
*moduledir
;
49 static const gchar
*plugindir
;
50 static const gchar
*prefix
;
51 static const gchar
*privdatadir
;
52 static const gchar
*ruledir
;
53 static const gchar
*sounddir
;
54 static const gchar
*sysconfdir
;
55 static const gchar
*toolsdir
;
56 static const gchar
*uidir
;
58 static HMODULE hmodule
;
59 G_LOCK_DEFINE_STATIC (mutex
);
61 /* Silence gcc with a prototype. Yes, this is silly. */
62 BOOL WINAPI
DllMain (HINSTANCE hinstDLL
,
66 /* Minimal DllMain that just tucks away the DLL's HMODULE */
68 DllMain (HINSTANCE hinstDLL
,
73 case DLL_PROCESS_ATTACH
:
81 replace_prefix (const gchar
*runtime_prefix
,
82 const gchar
*configure_time_path
)
85 strncmp (configure_time_path
, EVOLUTION_PREFIX
"/",
86 strlen (EVOLUTION_PREFIX
) + 1) == 0) {
87 return g_strconcat (runtime_prefix
,
88 configure_time_path
+ strlen (EVOLUTION_PREFIX
),
91 return g_strdup (configure_time_path
);
101 if (localedir
!= NULL
) {
106 /* This requires that the libeutil DLL is installed in $bindir */
107 full_prefix
= g_win32_get_package_installation_directory_of_module(hmodule
);
108 cp_prefix
= g_win32_locale_filename_from_utf8(full_prefix
);
110 localedir
= replace_prefix (cp_prefix
, EVOLUTION_LOCALEDIR
);
114 prefix
= g_strdup (full_prefix
);
116 /* It makes sense to have some of the paths overridable with
117 * environment variables.
119 bindir
= replace_prefix (full_prefix
, EVOLUTION_BINDIR
);
120 datadir
= replace_prefix (full_prefix
, EVOLUTION_DATADIR
);
121 ecpsdir
= replace_prefix (full_prefix
, EVOLUTION_ECPSDIR
);
122 etspecdir
= replace_prefix (full_prefix
, EVOLUTION_ETSPECDIR
);
123 galviewsdir
= replace_prefix (full_prefix
, EVOLUTION_GALVIEWSDIR
);
124 helpdir
= replace_prefix (full_prefix
, EVOLUTION_HELPDIR
);
125 if (g_getenv ("EVOLUTION_ICONDIR") &&
126 g_file_test (g_getenv ("EVOLUTION_ICONDIR"), G_FILE_TEST_IS_DIR
))
127 icondir
= g_getenv ("EVOLUTION_ICONDIR");
129 icondir
= replace_prefix (full_prefix
, EVOLUTION_ICONDIR
);
130 if (g_getenv ("EVOLUTION_IMAGESDIR") &&
131 g_file_test (g_getenv ("EVOLUTION_IMAGESDIR"), G_FILE_TEST_IS_DIR
))
132 imagesdir
= g_getenv ("EVOLUTION_IMAGESDIR");
134 imagesdir
= replace_prefix (full_prefix
, EVOLUTION_IMAGESDIR
);
135 libdir
= replace_prefix (full_prefix
, EVOLUTION_LIBDIR
);
136 libexecdir
= replace_prefix (full_prefix
, EVOLUTION_LIBEXECDIR
);
137 moduledir
= replace_prefix (full_prefix
, EVOLUTION_MODULEDIR
);
138 plugindir
= replace_prefix (full_prefix
, EVOLUTION_PLUGINDIR
);
139 privdatadir
= replace_prefix (full_prefix
, EVOLUTION_PRIVDATADIR
);
140 ruledir
= replace_prefix (full_prefix
, EVOLUTION_RULEDIR
);
141 sounddir
= replace_prefix (full_prefix
, EVOLUTION_SOUNDDIR
);
142 sysconfdir
= replace_prefix (full_prefix
, EVOLUTION_SYSCONFDIR
);
143 toolsdir
= replace_prefix (full_prefix
, EVOLUTION_TOOLSDIR
);
144 uidir
= replace_prefix (full_prefix
, EVOLUTION_UIDIR
);
146 g_free (full_prefix
);
151 #include "e-util-private.h" /* For prototypes */
153 #define GETTER(varbl) \
155 _e_get_##varbl (void) \
182 gpointer
_e_get_dll_hmodule (void)