diff --git a/NEWS.md b/NEWS.md index 0679e1f5..55f06fbd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ Red Panda C++ Version 2.1 - add fmtlib to the gcc compiler's lib distributed with RedPanda IDE windows version - add default autolink for fmtlib in Windows - reduce size of the executable of win-git-askpass tool + - change: remove "Optimize for the following machine" and "Optimize less, while maintaining full compatibility" options in the compiler setting panel, which are obseleted. + - change: escape spaces in the executabe path under linux. Red Panda C++ Version 2.0 diff --git a/RedPandaIDE/compiler/compilerinfo.cpp b/RedPandaIDE/compiler/compilerinfo.cpp index 48805847..d31c8b34 100644 --- a/RedPandaIDE/compiler/compilerinfo.cpp +++ b/RedPandaIDE/compiler/compilerinfo.cpp @@ -94,35 +94,35 @@ void CompilerInfo::prepareCompilerOptions() addOption(C_CMD_OPT_STD, QObject::tr("C Language standard (-std)"), groupName, true, false, false, "-std=", sl); // Optimization for cpu type - sl.clear(); - sl.append(QPair(QObject::tr("This CPU"),"native")); - sl.append(QPair("i386","i386")); - sl.append(QPair("i486","i486")); - sl.append(QPair("i586","i586")); - sl.append(QPair("i686","i686")); - sl.append(QPair("Pentium","pentium")); - sl.append(QPair("Pentium MMX","pentium-mmx")); - sl.append(QPair("Pentium Pro","pentiumpro")); - sl.append(QPair("Pentium 2","pentium2")); - sl.append(QPair("Pentium 3","pentium3")); - sl.append(QPair("Pentium 4","pentium4")); - sl.append(QPair("Conroe","core2")); - sl.append(QPair("Nehalem","corei7")); - sl.append(QPair("Sandy","corei7-avx")); - sl.append(QPair("K6","k6")); - sl.append(QPair("K6-2","k6-2")); - sl.append(QPair("K6-3","k6-3")); - sl.append(QPair("Athlon","athlon")); - sl.append(QPair("Athlon Tbird","athlon-tbird")); - sl.append(QPair("Athlon 4","athlon-4")); - sl.append(QPair("Athlon XP","athlon-xp")); - sl.append(QPair("Athlon MP","athlon-mp")); - sl.append(QPair("K8","k8")); - sl.append(QPair("K8 Rev.E","k8-sse3")); - sl.append(QPair("K10","barcelona")); - sl.append(QPair("Bulldozer","bdver1")); - addOption(CC_CMD_OPT_ARCH, QObject::tr("Optimize for the following machine (-march)"), groupName, true, true, false, "-march=", sl); - addOption(CC_CMD_OPT_TUNE, QObject::tr("Optimize less, while maintaining full compatibility (-tune)"), groupName, true, true, false, "-mtune=", sl); +// sl.clear(); +// sl.append(QPair(QObject::tr("This CPU"),"native")); +// sl.append(QPair("i386","i386")); +// sl.append(QPair("i486","i486")); +// sl.append(QPair("i586","i586")); +// sl.append(QPair("i686","i686")); +// sl.append(QPair("Pentium","pentium")); +// sl.append(QPair("Pentium MMX","pentium-mmx")); +// sl.append(QPair("Pentium Pro","pentiumpro")); +// sl.append(QPair("Pentium 2","pentium2")); +// sl.append(QPair("Pentium 3","pentium3")); +// sl.append(QPair("Pentium 4","pentium4")); +// sl.append(QPair("Conroe","core2")); +// sl.append(QPair("Nehalem","corei7")); +// sl.append(QPair("Sandy","corei7-avx")); +// sl.append(QPair("K6","k6")); +// sl.append(QPair("K6-2","k6-2")); +// sl.append(QPair("K6-3","k6-3")); +// sl.append(QPair("Athlon","athlon")); +// sl.append(QPair("Athlon Tbird","athlon-tbird")); +// sl.append(QPair("Athlon 4","athlon-4")); +// sl.append(QPair("Athlon XP","athlon-xp")); +// sl.append(QPair("Athlon MP","athlon-mp")); +// sl.append(QPair("K8","k8")); +// sl.append(QPair("K8 Rev.E","k8-sse3")); +// sl.append(QPair("K10","barcelona")); +// sl.append(QPair("Bulldozer","bdver1")); +// addOption(CC_CMD_OPT_ARCH, QObject::tr("Optimize for the following machine (-march)"), groupName, true, true, false, "-march=", sl); +// addOption(CC_CMD_OPT_TUNE, QObject::tr("Optimize less, while maintaining full compatibility (-tune)"), groupName, true, true, false, "-mtune=", sl); // Enable use of the specific instructions sl.clear(); diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index 64c78f54..5c4d783b 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -270,18 +270,18 @@ void CompilerManager::run( .arg(consolePauserPath) .arg(consoleFlag) .arg(sharedMemoryId) - .arg(redirectInputFilename) - .arg(localizePath(filename)) + .arg(escapeSpacesInString(redirectInputFilename)) + .arg(localizePath(escapeSpacesInString(filename))) .arg(arguments); } else { newArguments = QString(" -e \"%1\" %2 %3 \"%4\" %5") .arg(consolePauserPath) .arg(consoleFlag) - .arg(sharedMemoryId,localizePath(filename)).arg(arguments); + .arg(sharedMemoryId,localizePath(escapeSpacesInString(filename))).arg(arguments); } } else { newArguments = QString(" -e \"%1\" %2") - .arg(localizePath(filename)).arg(arguments); + .arg(localizePath(escapeSpacesInString(filename))).arg(arguments); } execRunner = new ExecutableRunner(pSettings->environment().terminalPath(),newArguments,workDir); execRunner->setShareMemoryId(sharedMemoryId); diff --git a/libs/redpanda_qt_utils/qt_utils/utils.cpp b/libs/redpanda_qt_utils/qt_utils/utils.cpp index afa248a5..3c41fd57 100644 --- a/libs/redpanda_qt_utils/qt_utils/utils.cpp +++ b/libs/redpanda_qt_utils/qt_utils/utils.cpp @@ -689,3 +689,9 @@ QString absolutePath(const QString &dirPath, const QString &relativePath) { return QDir::cleanPath(QDir(dirPath).absoluteFilePath(relativePath)); } + +QString escapeSpacesInString(const QString &str) +{ + QString result=str; + return result.replace(' ',"%20"); +} diff --git a/libs/redpanda_qt_utils/qt_utils/utils.h b/libs/redpanda_qt_utils/qt_utils/utils.h index 80e5e226..4034c912 100644 --- a/libs/redpanda_qt_utils/qt_utils/utils.h +++ b/libs/redpanda_qt_utils/qt_utils/utils.h @@ -130,6 +130,7 @@ QString extractFilePath(const QString& filePath); QString extractAbsoluteFilePath(const QString& filePath); QString cleanPath(const QString& dirPath); QString absolutePath(const QString& dirPath, const QString& relativePath); +QString escapeSpacesInString(const QString& str); bool isReadOnly(const QString& filename); diff --git a/tools/consolepauser/main.unix.cpp b/tools/consolepauser/main.unix.cpp index 791c5e05..edf5ae3d 100644 --- a/tools/consolepauser/main.unix.cpp +++ b/tools/consolepauser/main.unix.cpp @@ -68,6 +68,21 @@ vector GetCommand(int argc,char** argv,bool &reInp,bool &pauseAfterExit) return result; } +string unescapeSpaces(const string& s) { + string result; + int i=0; + while(i& command,bool reInp) { pid_t pid = fork(); if (pid == 0) { @@ -80,8 +95,8 @@ int ExecuteCommand(vector& command,bool reInp) { printf("not enough arguments1!\n"); exit(-1); } - freopen(command[0].c_str(),"r",stdin); - path_to_command = command[1]; + freopen(unescapeSpaces(command[0]).c_str(),"r",stdin); + path_to_command = unescapeSpaces(command[1]); command_size = command.size()+1; command_begin = 1; } else { @@ -89,7 +104,7 @@ int ExecuteCommand(vector& command,bool reInp) { printf("not enough arguments2!\n"); exit(-1); } - path_to_command = command[0]; + path_to_command = unescapeSpaces(command[0]); command_size = command.size()+1; command_begin = 0; }