mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
fix: cannot open saved games with extra dots in the name
This commit is contained in:
@@ -64,9 +64,9 @@ void CMapInfo::saveInit(const ResourcePath & file)
|
||||
else
|
||||
lf.load(scenarioOptionsOfSave);
|
||||
|
||||
fileURI = file.getName();
|
||||
originalFileURI = file.getOriginalName();
|
||||
fullFileURI = CResourceHandler::get()->getFullFileURI(file);
|
||||
fileURI = file.getName(); // Name without file extension
|
||||
originalFileURI = file.getOriginalName(); // Same as file.getName()
|
||||
fullFileURI = CResourceHandler::get()->getFullFileURI(file); // Includes absolute path + extension
|
||||
countPlayers();
|
||||
lastWrite = CResourceHandler::get()->getLastWriteTime(file);
|
||||
date = TextOperations::getFormattedDateTimeLocal(lastWrite);
|
||||
|
||||
@@ -1607,11 +1607,13 @@ void CGameHandler::save(const std::string & filename)
|
||||
void CGameHandler::load(const StartInfo &info)
|
||||
{
|
||||
logGlobal->info("Loading from %s", info.mapname);
|
||||
const auto stem = FileInfo::GetPathStem(info.mapname);
|
||||
// No need to use the stem because info.mapname doesn't come with the file extension included
|
||||
// const auto stem = FileInfo::GetPathStem(info.mapname);
|
||||
|
||||
reinitScripting();
|
||||
|
||||
CLoadFile lf(*CResourceHandler::get()->getResourceName(ResourcePath(stem.to_string(), EResType::SAVEGAME)), gs.get());
|
||||
// CLoadFile lf(*CResourceHandler::get()->getResourceName(ResourcePath(stem.to_string(), EResType::SAVEGAME)), gs.get());
|
||||
CLoadFile lf(*CResourceHandler::get()->getResourceName(ResourcePath(info.mapname, EResType::SAVEGAME)), gs.get());
|
||||
gs = std::make_shared<CGameState>();
|
||||
randomizer = std::make_unique<GameRandomizer>(*gs);
|
||||
gs->loadGame(lf);
|
||||
|
||||
Reference in New Issue
Block a user