diff --git a/src/karts/kart_properties.cpp b/src/karts/kart_properties.cpp index 9859b0e5a..705c6b134 100644 --- a/src/karts/kart_properties.cpp +++ b/src/karts/kart_properties.cpp @@ -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); diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 309c3e374..ea5a30c1d 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -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 += "/";