[Mono-dev] mono_path_canonicalize strips \\ from network paths on Windows

Aras Pranckevicius aras at unity3d.com
Fri Nov 16 03:55:12 EST 2007


Hi,

Some of our customers noticed that our Windows games don't run if
launched from network shares (e.g. \\somecomputer\path\game.exe).
Turns out AppDomain.CreateDomain throws exception when assemblies are
referenced via network path.

When debugging, I noticed that image open functions turn paths like
'\\somecomputer\path' into '\somecomputer\path' (turns double
backslash into a single one). mono_path_canonicalize does this.

In our case, changing this:
	if (dest != lastpos) {
		strcpy (dest, lastpos);
	}
at the end of mono_path_canonicalize into this:
	if (dest != lastpos) {
		/* on Windows, do not strip '\\' from the beginning of network paths */
		#if defined (PLATFORM_WIN32)
		if( dest && dest[0] == G_DIR_SEPARATOR && lastpos && lastpos[0] == 0 )
		{
		}
		else
		#endif
			strcpy (dest, lastpos);
	}
fixes the issue and makes everything work on network shares.


But as you can see from the code, I obviously don't know what I'm
doing and the same effect can probably be achieved much more
elegantly.


-- 
Aras Pranckevicius
work: http://unity3d.com
home: http://aras-p.info



More information about the Mono-devel-list mailing list