core/sourcemod.cpp
changeset 1729 0f60cc4ce8bb
parent 1721 d54c379f7171
child 1770 9c545310f947
     1.1 --- a/core/sourcemod.cpp	Tue Nov 27 01:59:38 2007 +0000
     1.2 +++ b/core/sourcemod.cpp	Tue Nov 27 02:19:39 2007 +0000
     1.3 @@ -443,20 +443,35 @@
     1.4  	vsnprintf(_buffer, PLATFORM_MAX_PATH, format, ap);
     1.5  	va_end(ap);
     1.6  
     1.7 +	/* If we get a "file://" notation, strip off the file:// part so we're left 
     1.8 +	 * with an absolute path.  Note that the absolute path gets returned, so 
     1.9 +	 * usage with relative paths here is completely invalid.
    1.10 +	 */
    1.11 +	if (type != Path_SM_Rel && strncmp(_buffer, "file://", 7) == 0)
    1.12 +	{
    1.13 +		return g_LibSys.PathFormat(buffer, maxlength, "%s", &_buffer[7]);
    1.14 +	}
    1.15 +
    1.16  	const char *base = NULL;
    1.17  	if (type == Path_Game)
    1.18  	{
    1.19  		base = GetGamePath();
    1.20 -	} else if (type == Path_SM) {
    1.21 +	}
    1.22 +	else if (type == Path_SM)
    1.23 +	{
    1.24  		base = GetSourceModPath();
    1.25 -	} else if (type == Path_SM_Rel) {
    1.26 +	}
    1.27 +	else if (type == Path_SM_Rel)
    1.28 +	{
    1.29  		base = m_SMRelDir;
    1.30  	}
    1.31  
    1.32  	if (base)
    1.33  	{
    1.34  		return g_LibSys.PathFormat(buffer, maxlength, "%s/%s", base, _buffer);
    1.35 -	} else {
    1.36 +	}
    1.37 +	else
    1.38 +	{
    1.39  		return g_LibSys.PathFormat(buffer, maxlength, "%s", _buffer);
    1.40  	}
    1.41  }