diff options
Diffstat (limited to 'src/libs/installer')
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 27 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore.h | 3 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index 232024f66..311ac544d 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -1003,6 +1003,33 @@ QString PackageManagerCore::readConsoleLine(const QString &title, qint64 maxlen) } /*! + Returns \a path with the '/' separators converted to separators that are + appropriate for the underlying operating system. + + On Unix platforms the returned string is the same as the argument. + + \sa {installer::toNativeSeparators}{installer.toNativeSeparators} + \sa fromNativeSeparators() +*/ +QString PackageManagerCore::toNativeSeparators(const QString &path) +{ + return QDir::toNativeSeparators(path); +} + +/*! + Returns \a path using '/' as file separator. + + On Unix platforms the returned string is the same as the argument. + + \sa {installer::fromNativeSeparators}{installer.fromNativeSeparators} + \sa toNativeSeparators() +*/ +QString PackageManagerCore::fromNativeSeparators(const QString &path) +{ + return QDir::fromNativeSeparators(path); +} + +/*! Checks whether the target directory \a targetDirectory exists and has contents: \list \li Returns \c true if the directory exists and is empty. diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h index b5ef6304e..6698155c3 100644 --- a/src/libs/installer/packagemanagercore.h +++ b/src/libs/installer/packagemanagercore.h @@ -213,6 +213,9 @@ public: Q_INVOKABLE QString readFile(const QString &filePath, const QString &codecName) const; Q_INVOKABLE QString readConsoleLine(const QString &title = QString(), qint64 maxlen = 0) const; + Q_INVOKABLE QString toNativeSeparators(const QString &path); + Q_INVOKABLE QString fromNativeSeparators(const QString &path); + bool checkTargetDir(const QString &targetDirectory); QString targetDirWarning(const QString &targetDirectory) const; |