Use default eeprom file if none is provided

This commit is contained in:
John Stäck 2019-06-24 14:11:58 +02:00
parent 829c08c031
commit 2c3df24fc1
2 changed files with 13 additions and 8 deletions

View file

@ -620,5 +620,14 @@ int main(int argc, const char** argv)
parser.ParseCLI(argc, argv);
return SimRun(args::get(eepromFile), args::get(eepromWrite), args::get(factoryReset));
std::string eepromFileName = args::get(eepromFile);
//Use a default EEPROM file if none is provided.
if(eepromFileName.length()==0)
{
eepromFileName = SDL_GetPrefPath("Vulk Data System", "NuEVI Simulator");
eepromFileName += "eeprom.bin";
}
return SimRun(eepromFileName, args::get(eepromWrite), args::get(factoryReset));
}

View file

@ -109,13 +109,9 @@ int16_t EEPROMClass::setStorage(const char* filename, bool write)
}
void EEPROMClass::closeStorage() {
if(storage==NULL)
if(storage!=NULL)
{
return;
fclose(storage);
storage=NULL;
}
printf("Closing EEPROM storage\n");
fclose(storage);
storage=NULL;
}