Made relative infoURL relative to the current directory (the addon's dir)

instead of to the main data directory.
ver1_5_1
Christophe Teyssier 2006-07-24 18:21:19 +00:00
parent 183091936b
commit 0647d52bca
2 changed files with 26 additions and 3 deletions

View File

@ -146,8 +146,19 @@ bool DeepSkyObject::load(AssociativeArray* params, const string& resPath)
setAbsoluteMagnitude((float) absMag);
string infoURL;
if (params->getString("InfoURL", infoURL))
if (params->getString("InfoURL", infoURL))
{
if (infoURL.find(':') == string::npos)
{
// Relative URL, the base directory is the current one,
// not the main installation directory
if (resPath[1] == ':')
// Absolute Windows path, file:/// is required
infoURL = "file:///" + resPath + "/" + infoURL;
else
infoURL = resPath + "/" + infoURL;
}
setInfoURL(infoURL);
}
return true;
}

View File

@ -293,8 +293,20 @@ static Body* CreatePlanet(PlanetarySystem* system,
body->setLifespan(beginning, ending);
string infoURL;
if (planetData->getString("InfoURL", infoURL))
if (planetData->getString("InfoURL", infoURL))
{
if (infoURL.find(':') == string::npos)
{
// Relative URL, the base directory is the current one,
// not the main installation directory
if (path[1] == ':')
// Absolute Windows path, file:/// is required
infoURL = "file:///" + path + "/" + infoURL;
else
infoURL = path + "/" + infoURL;
}
body->setInfoURL(infoURL);
}
double albedo = 0.5;
if (planetData->getNumber("Albedo", albedo))