diff --git a/NEWS.md b/NEWS.md index 7e9f0d66..a1eec31b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ Red Panda C++ Version 1.4 - fix: crash when create non C/C++ source file in project - fix: can't open text project file in the editor - change: when create non-text project file, don't auto open it + - fix: the project compiler options is not correctly read when open old dev-c++ project Red Panda C++ Version 1.3 diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index 1377f68b..56225a91 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -1769,6 +1769,28 @@ void Project::loadOptions(SimpleIni& ini) QByteArray oldCompilerOptions = ini.GetValue("Project", "CompilerSettings", ""); if (!oldCompilerOptions.isEmpty()) { //version 2 compatibility + // test if it is created by old dev-c++ + SimpleIni::TNamesDepend oKeys; + ini.GetAllKeys("Project", oKeys); + bool isNewDev=false; + for(const SimpleIni::Entry& entry:oKeys) { + QString key(entry.pItem); + if (key=="UsePrecompiledHeader" + || key == "CompilerSetType" + || key == "StaticLink" + || key == "AddCharset" + || key == "ExecEncoding" + || key == "Encoding" + || key == "UseUTF8") { + isNewDev = true; + break; + } + } + if (!isNewDev && oldCompilerOptions.length()>=25) { + char t = oldCompilerOptions[18]; + oldCompilerOptions[18]=oldCompilerOptions[21]; + oldCompilerOptions[21]=t; + } for (int i=0;icompilerSets().getKeyFromCompilerCompatibleIndex(i); PCompilerOption pOption = CompilerInfoManager::getCompilerOption( diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index dc4c34bb..87890a9f 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -2893,7 +2893,7 @@ void Settings::CompilerSets::prepareCompatibleIndex() //old settings compatibility, don't reorder, add or remove items mCompilerCompatibleIndex.append(CC_CMD_OPT_ANSI); - mCompilerCompatibleIndex.append(CC_CMD_OPT_NO_ASM "gcc_cmd_opt_no_asm"); + mCompilerCompatibleIndex.append(CC_CMD_OPT_NO_ASM); mCompilerCompatibleIndex.append(CC_CMD_OPT_TRADITIONAL_CPP); mCompilerCompatibleIndex.append(CC_CMD_OPT_ARCH);