const QString VERSION("2015.12.15");
+inline QString addEsc(const QString& text){
+ QString rc = text;
+#if defined WIN32
+ rc.replace("\\", "\\\\");
+#endif
+ return rc;
+}
+
/**
* @brief Constructor.
*
QString replaceEscSequences(const QString& text){
QString rc = text;
int start = 0;
- QString replacement;
while (start < rc.length()){
- start = text.indexOf('\\', start);
- if (start < 0)
+ int ix = text.indexOf('\\', start);
+ if (ix < 0)
break;
+ start += ix;
QChar replacement = 0;
switch (text[start + 1].toLatin1()) {
case 'n':
replacement = text[start + 1];
break;
}
- rc.remove(start, 1);
- rc[start] = replacement;
- start++;
+ rc.replace(start, 2, replacement);
+ start++;
}
return rc;
}
for (int ii = 0; ii < count; ii++){
QString line = ui->comboBoxTemplate->currentText();
QMap < QString, QString > placeholders;
- QString path = m_lastBaseDir.absoluteFilePath(
+ QString path = m_lastBaseDir.absoluteFilePath(
ReFileUtils::pathAppend(ui->tableWidget->item(ii, TC_PATH)->text(),
ui->tableWidget->item(ii, TC_NODE)->text()));
- placeholders.insert("full", ReQStringUtils::nativePath(path));
- placeholders.insert("path", ui->tableWidget->item(ii, TC_PATH)->text());
+ placeholders.insert("full", addEsc(ReQStringUtils::nativePath(path)));
+ path = ReFileUtils::nativePath(ui->tableWidget->item(ii, TC_PATH)->text());
+ placeholders.insert("path", addEsc(path));
placeholders.insert("ext", ui->tableWidget->item(ii, TC_EXT)->text());
placeholders.insert("node", ui->tableWidget->item(ii, TC_NODE)->text());
placeholders.insert("modified",
msgBox.exec();
}
-inline QString addEsc(const QString& text){
- QString rc = text;
-#if defined WIN32
- rc.replace("\\", "\\\\");
-#endif
- return rc;
-}
-
/**
* Builds the hash with the global placeholders with their current values.
*
*/
void MainWindow::buildGlobalPlaceholders(QMap <QString, QString>& hash){
- hash.insert("filepatterns", addEsc(ui->comboBoxFilePatterns->currentText()));
+ hash.insert("filepatterns", ui->comboBoxFilePatterns->currentText());
hash.insert("base", m_lastBaseDir.absolutePath());
hash.insert("textpattern", addEsc(ui->comboBoxTextPattern->currentText()));
hash.insert("dirs", QString::number(m_statistics.m_dirs));
}
}
}
- if (withBase && (rmdir(I18N::s2b(path))) != 0) {
+ if (withBase && (_rmdir(I18N::s2b(path))) != 0) {
rc = false;
logger->logv(LOG_ERROR, LOC_DELETE_TREE_3,
"cannot delete directory (%d): %s", errno, I18N::s2b(path).constData());
rc += node;
struct stat info;
if (deleteIfExists && stat(rc.constData(), &info) == 0)
- unlink(rc.constData());
+ _unlink(rc.constData());
return rc;
}
fputc('\n', m_fp);
fflush(m_fp);
}
-#pragma GCC diagnostic warning "-Wunused-parameter"
/** @class ReFileAppender ReLogger.hpp "base/ReLogger.hpp"
*
* @param message the logging message
* @param logger the calling logger
*/
-#pragma GCC diagnostic ignored "-Wunused-parameter"
void ReFileAppender::log(ReLoggerLevel level, int location, const char* message,
ReLogger* logger) {
if (m_fp != NULL) {
fflush(m_fp);
}
}
-#pragma GCC diagnostic warning "-Wunused-parameter"
/** @class ReMemoryAppender ReLogger.hpp "base/ReLogger.hpp"
*
* @param message the logging message
* @param logger the calling logger
*/
-#pragma GCC diagnostic ignored "-Wunused-parameter"
void ReMemoryAppender::log(ReLoggerLevel level, int location,
const char* message, ReLogger* logger) {
if (m_lines.size() >= m_maxLines)
m_lines.append(msg);
}
}
-#pragma GCC diagnostic warning "-Wunused-parameter"
/**
* @brief Returns the list of lines.