replace simple regexp with .endsWith()
This commit is contained in:
parent
e99e35c8a7
commit
0e3c60e8a1
@ -140,8 +140,7 @@ namespace qcross {
|
|||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select a package to import"),
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Select a package to import"),
|
||||||
QString(), tr("QCross Package (*.cpk)"));
|
QString(), tr("QCross Package (*.cpk)"));
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
/* if (!File::exists(QCROSS_STRING_DATAPATH))
|
QDir().mkpath(QCROSS_STRING_DATAPATH);
|
||||||
QDir::mkpath(QCROSS_STRING_DATAPATH);*/
|
|
||||||
|
|
||||||
QString newFileName = QCROSS_STRING_DATAPATH + QDir::separator() + fileName.section(QDir::separator(), -1);
|
QString newFileName = QCROSS_STRING_DATAPATH + QDir::separator() + fileName.section(QDir::separator(), -1);
|
||||||
if (QFile::copy(fileName, newFileName))
|
if (QFile::copy(fileName, newFileName))
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <libqnono/constants.h>
|
#include <libqnono/constants.h>
|
||||||
|
|
||||||
#define QCROSS_STRING_DATAPATH ((QDir::homePath() + QDir::separator()) + ".qcross")
|
#define QCROSS_STRING_DATAPATH (QDir::homePath() + QDir::separator() + ".config" + QDir::separator() + "qcross")
|
||||||
#define QCROSS_STRING_PACKAGE_EXT ".cpk"
|
#define QCROSS_STRING_PACKAGE_EXT ".cpk"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -153,7 +153,7 @@ namespace qcrossedit {
|
|||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Select a file name for the current package"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Select a file name for the current package"),
|
||||||
QString(), tr("QCross Package (*.cpk)"));
|
QString(), tr("QCross Package (*.cpk)"));
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
if (!QRegExp("*.cpk").exactMatch(fileName))
|
if (!fileName.endsWith(".cpk", Qt::CaseInsensitive))
|
||||||
fileName.append(".cpk");
|
fileName.append(".cpk");
|
||||||
|
|
||||||
m_Package->setFileName(fileName);
|
m_Package->setFileName(fileName);
|
||||||
|
Loading…
Reference in New Issue
Block a user