1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 01:05:10 +03:00

Standalone simu would crash for "normal" Windows users on launch as they don't have write permissions to the Program Files folder. New method should be portable and store eeprom files in the user's standard document location.

This commit is contained in:
Andre Bernet 2014-04-10 10:24:11 +02:00
parent cb7484cffa
commit c19dea8472

View file

@ -102,6 +102,10 @@ int main(int argc, char *argv[])
RegisterFirmwares();
SimulatorDialog *dialog;
const char * eepromFileName;
QString fileName;
QByteArray path;
QDir eedir;
QFile file;
QMessageBox msgBox;
msgBox.setWindowTitle("Radio type");
@ -111,17 +115,27 @@ int main(int argc, char *argv[])
msgBox.addButton("9X", QMessageBox::ActionRole);
QPushButton *exitButton = msgBox.addButton(QMessageBox::Close);
eedir = QDir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
if (!eedir.exists("OpenTX")) {
eedir.mkdir("OpenTX");
}
eedir.cd("OpenTX");
msgBox.exec();
if (msgBox.clickedButton() == exitButton)
return 0;
else if (msgBox.clickedButton() == taranisButton) {
current_firmware_variant = GetFirmwareVariant("opentx-taranis-en");
eepromFileName = "eeprom-taranis.bin";
fileName = eedir.filePath("eeprom-taranis.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialogTaranis();
}
else {
eepromFileName = "eeprom-9x.bin";
fileName = eedir.filePath("eeprom-9x.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialog9X();
}