mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Clean up misc::isValidFileSystemName() function
This commit is contained in:
parent
fb60a6489b
commit
68041e382d
2 changed files with 4 additions and 7 deletions
|
@ -575,13 +575,10 @@ QString misc::toValidFileSystemName(QString filename) {
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool misc::isValidFileSystemName(QString filename) {
|
bool misc::isValidFileSystemName(const QString& filename) {
|
||||||
filename.replace("\\", "/").trimmed();
|
|
||||||
if(filename.isEmpty()) return false;
|
if(filename.isEmpty()) return false;
|
||||||
const QRegExp regex("[/:?\"*<>|]");
|
const QRegExp regex("[\\\\/:?\"*<>|]");
|
||||||
if(filename.contains(regex))
|
return !filename.contains(regex);
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
|
|
|
@ -140,7 +140,7 @@ public:
|
||||||
static bool isUrl(const QString &s);
|
static bool isUrl(const QString &s);
|
||||||
static void copyDir(QString src_path, QString dst_path);
|
static void copyDir(QString src_path, QString dst_path);
|
||||||
static QString toValidFileSystemName(QString filename);
|
static QString toValidFileSystemName(QString filename);
|
||||||
static bool isValidFileSystemName(QString filename);
|
static bool isValidFileSystemName(const QString& filename);
|
||||||
|
|
||||||
/* Ported from Qt4 to drop dependency on QtGui */
|
/* Ported from Qt4 to drop dependency on QtGui */
|
||||||
static QString QDesktopServicesDataLocation();
|
static QString QDesktopServicesDataLocation();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue