* metadata/Makefile.am: link to ../os/libmonoos.la on windows.
* metadata/assembly.c:
-If MONO_DEBUG, warn about non-existing directories in
MONO_PATH.
-Added mono_assembly_getrootdir() that replaces MONO_ASSEMBLIES
compile time variable.
-Removed init_default_path and call mono_set_rootdir from
libmonoos.a instead (windows only).
* metadata/assembly.h: declare mono_assembly_getrootdir().
* metadata/domain.c:
* metadata/icall.c: use mono_assembly_getrootdir() instead of
MONO_ASSEMBLIES.
* metadata/loader.c: s/getenv/g_getenv/
* os/win32/util.c: the path from GetModuleFileName is UTF-16.
svn path=/trunk/mono/; revision=27134
+2004-05-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Makefile.am: link to ../os/libmonoos.la on windows.
+
+ * assembly.c:
+ -If MONO_DEBUG, warn about non-existing directories in
+ MONO_PATH.
+ -Added mono_assembly_getrootdir() that replaces MONO_ASSEMBLIES
+ compile time variable.
+ -Removed init_default_path and call mono_set_rootdir from
+ libmonoos.a instead (windows only).
+
+ * assembly.h: declare mono_assembly_getrootdir().
+
+ * domain.c:
+ * icall.c: use mono_assembly_getrootdir() instead of MONO_ASSEMBLIES.
+
+ * loader.c: s/getenv/g_getenv/
+
2004-05-11 Zoltan Varga <vargaz@freemail.hu>
* marshal.{h,c}: Add support for UnmanagedType.AsAny.
* metadata.h: Add new marshalling conversions.
- * metadata.h metadata.c (mono_metadata_signature_dup): New helper function.
+ * metadata.h metadata.c (mono_metadata_signature_dup): New helper
+ function.
* reflection.c (mono_reflection_get_type): Lookup the type in all
modules of a multi-module assembly. Fixes #58291.
2004-05-11 Lluis Sanchez Gual <lluis@ximian.com>
- * threads.c: Before aborting a background, set the StopRequested state (this
- avoids throwing the Abort exception).
- In mono_thread_manage, don't continue with the shutdown until all aborted
- threads have actually stopped.
+ * threads.c: Before aborting a background, set the StopRequested
+ state. This avoids throwing the Abort exception.
+ In mono_thread_manage, don't continue with the shutdown until all
+ aborted threads have actually stopped.
2004-05-10 Jackson Harper <jackson@ximian.com>
bundle_srcs =
endif
+if PLATFORM_WIN32
+libmonoruntime_la_LIBADD = ../os/libmonoos.la
+endif
+
libmonoruntime_la_SOURCES = \
reflection.c \
object.c \
#include <mono/utils/mono-uri.h>
#include <mono/metadata/mono-config.h>
#include <mono/utils/mono-digest.h>
+#ifdef PLATFORM_WIN32
+#include <mono/os/util.h>
+#endif
/* the default search path is just MONO_ASSEMBLIES */
static const char*
static gboolean allow_user_gac = FALSE;
-#ifdef PLATFORM_WIN32
-
-static void
-init_default_path (void)
-{
- int i;
-
- default_path [0] = g_strdup (MONO_ASSEMBLIES);
- for (i = strlen (MONO_ASSEMBLIES) - 1; i >= 0; i--) {
- if (default_path [0][i] == '/')
- ((char*) default_path [0])[i] = '\\';
- }
-}
-#endif
-
-
static gchar*
encode_public_tok (const guchar *token, gint32 len)
{
path = getenv ("MONO_PATH");
if (!path)
return;
+
splitted = g_strsplit (path, G_SEARCHPATH_SEPARATOR_S, 1000);
if (assemblies_path)
g_strfreev (assemblies_path);
assemblies_path = splitted;
+ if (g_getenv ("MONO_DEBUG") == NULL)
+ return;
+
+ while (*splitted) {
+ if (**splitted && !g_file_test (*splitted, G_FILE_TEST_IS_DIR))
+ g_warning ("'%s' in MONO_PATH doesn't exist or has wrong permissions.", *splitted);
+
+ splitted++;
+ }
}
static gboolean
default_path [0] = g_strdup (root_dir);
}
+G_CONST_RETURN gchar *
+mono_assembly_getrootdir (void)
+{
+ return default_path [0];
+}
+
/**
* mono_assemblies_init:
*
mono_assemblies_init (void)
{
#ifdef PLATFORM_WIN32
- init_default_path ();
+ mono_set_rootdir ();
#endif
check_env ();
fullname = g_strdup_printf ("%s.dll", name);
- gacpath = g_build_path (G_DIR_SEPARATOR_S, MONO_ASSEMBLIES, "mono", "gac", name, NULL);
+ gacpath = g_build_path (G_DIR_SEPARATOR_S, mono_assembly_getrootdir (), "mono", "gac", name, NULL);
res = probe_for_partial_name (gacpath, fullname, status);
g_free (gacpath);
aname->culture == NULL ? "" : aname->culture,
aname->public_tok_value);
- fullpath = g_build_path (G_DIR_SEPARATOR_S, MONO_ASSEMBLIES, "mono", "gac",
+ fullpath = g_build_path (G_DIR_SEPARATOR_S, mono_assembly_getrootdir (), "mono", "gac",
name, version, filename, NULL);
result = mono_assembly_open (fullpath, status);
const char *basedir,
MonoImageOpenStatus *status);
MonoAssembly* mono_assembly_load_from (MonoImage *image, const char *fname,
- MonoImageOpenStatus *status);
+ MonoImageOpenStatus *status);
+
MonoAssembly* mono_assembly_load_with_partial_name (const char *name, MonoImageOpenStatus *status);
MonoAssembly* mono_assembly_loaded (MonoAssemblyName *aname);
MonoImage* mono_assembly_load_module (MonoAssembly *assembly, guint32 idx);
void mono_assembly_close (MonoAssembly *assembly);
void mono_assembly_setrootdir (const char *root_dir);
+G_CONST_RETURN gchar *mono_assembly_getrootdir (void);
void mono_assembly_foreach (GFunc func, gpointer user_data);
void mono_assembly_set_main (MonoAssembly *assembly);
MonoAssembly *mono_assembly_get_main (void);
switch (status){
case MONO_IMAGE_ERROR_ERRNO:
g_print ("The assembly mscorlib.dll was not found or could not be loaded.\n");
- g_print ("It should have been installed in the `%s' directory.\n", MONO_ASSEMBLIES);
+ g_print ("It should have been installed in the `%s' directory.\n",
+ mono_assembly_getrootdir ());
break;
case MONO_IMAGE_IMAGE_INVALID:
- g_print ("The file %s/mscorlib.dll is an invalid CIL image\n", MONO_ASSEMBLIES);
+ g_print ("The file %s/mscorlib.dll is an invalid CIL image\n",
+ mono_assembly_getrootdir ());
break;
case MONO_IMAGE_MISSING_ASSEMBLYREF:
- g_print ("Minning assembly reference in %s/mscorlib.dll\n", MONO_ASSEMBLIES);
+ g_print ("Missing assembly reference in %s/mscorlib.dll\n",
+ mono_assembly_getrootdir ());
break;
case MONO_IMAGE_OK:
/* to suppress compiler warning */
static MonoString*
ves_icall_System_Environment_GetGacPath (void)
{
- return mono_string_new (mono_domain_get (), MONO_ASSEMBLIES);
+ return mono_string_new (mono_domain_get (), mono_assembly_getrootdir ());
}
static MonoString*
}
if (!gmodule) {
- if (getenv ("MONO_DEBUG")) {
+ if (g_getenv ("MONO_DEBUG")) {
gchar *error = g_strdup (g_module_error ());
g_message ("Error loading '%s': %s\n", orig_scope, error);
g_free (error);
void
mono_set_rootdir (void)
{
- char moddir[MAXPATHLEN], *bindir, *installdir, *root;
+ gunichar2 moddir [MAXPATHLEN];
+ gchar *bindir, *installdir, *root, *utf8name;
GetModuleFileName (NULL, moddir, sizeof(moddir));
- bindir = g_path_get_dirname (moddir);
+ utf8name = g_utf16_to_utf8 (moddir, -1, NULL, NULL, NULL);
+ bindir = g_path_get_dirname (utf8name);
installdir = g_path_get_dirname (bindir);
root = g_build_path (G_DIR_SEPARATOR_S, installdir, "lib", NULL);
g_free (root);
g_free (installdir);
g_free (bindir);
+ g_free (utf8name);
}