Fixed #894: nameclash when an addon track/kart has the same directory name (and therefore

identifier) as a track included in STK.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12581 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2013-03-26 06:16:53 +00:00
parent 81d6353d7b
commit f78f254a3e
2 changed files with 11 additions and 0 deletions

View File

@ -174,6 +174,11 @@ void KartProperties::load(const std::string &filename, const std::string &node)
const XMLNode * root = 0;
m_root = StringUtils::getPath(filename)+"/";
m_ident = StringUtils::getBasename(StringUtils::getPath(filename));
// If this is an addon kart, add "addon_" to the identifier - just in
// case that an addon kart has the same directory name (and therefore
// identifier) as an included kart.
if(StringUtils::startsWith(filename, file_manager->getAddonsDir()))
m_ident = "addon_"+m_ident;
try
{
root = new XMLNode(filename);

View File

@ -85,6 +85,12 @@ Track::Track(const std::string &filename)
m_root =
StringUtils::getPath(StringUtils::removeExtension(m_filename));
m_ident = StringUtils::getBasename(m_root);
// If this is an addon track, add "addon_" to the identifier - just in
// case that an addon track has the same directory name (and therefore
// identifier) as an included track.
if(StringUtils::startsWith(filename, file_manager->getAddonsDir()))
m_ident = "addon_"+m_ident;
// The directory should always have a '/' at the end, but getBasename
// above returns "" if a "/" is at the end, so we add the "/" here.
m_root += "/";