diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 9b1ec3917a..8b3dd5d82f 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1826,6 +1826,8 @@ QFileInfoList QDir::drives() underlying operating system. If you want to display paths to the user using their operating system's separator use toNativeSeparators(). + + \sa listSeparator() */ QChar QDir::separator() { @@ -1836,6 +1838,16 @@ QChar QDir::separator() #endif } +/*! + \fn QDir::listSeparator() + \since 5.6 + + Returns the native path list separator: ':' under Unix + and ';' under Windows. + + \sa separator() +*/ + /*! Sets the application's current working directory to \a path. Returns \c true if the directory was successfully changed; otherwise diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h index e622011f98..b6946eba65 100644 --- a/src/corelib/io/qdir.h +++ b/src/corelib/io/qdir.h @@ -177,7 +177,16 @@ public: static QFileInfoList drives(); - static QChar separator(); + Q_DECL_CONSTEXPR static inline QChar listSeparator() Q_DECL_NOTHROW + { +#if defined(Q_OS_WIN) + return QLatin1Char(';'); +#else + return QLatin1Char(':'); +#endif + } + + static QChar separator(); // ### Qt6: Make it inline static bool setCurrent(const QString &path); static inline QDir current() { return QDir(currentPath()); }