If you want to find the directory containing the application's executable,
see \l{QCoreApplication::applicationDirPath()}.
- The drives() static function provides a list of root directories for each
- device that contains a filing system. On Unix systems this returns a list
- containing a single root directory "/"; on Windows the list will usually
- contain \c{C:/}, and possibly other drive letters such as \c{D:/}, depending
- on the configuration of the user's system.
-
\section1 Path Manipulation and Strings
Paths containing "." elements that reference the current directory at that
}
/*!
- Returns a list of the root directories on this system.
-
- On Windows this returns a list of QFileInfo objects containing "C:/",
- "D:/", etc. On other operating systems, it returns a list containing
- just one root directory (i.e. "/").
-
- \sa root(), rootPath()
-*/
-QFileInfoList QDir::drives()
-{
-#ifdef QT_NO_FSFILEENGINE
- return QFileInfoList();
-#else
- return QFSFileEngine::drives();
-#endif
-}
-
-/*!
\fn QChar QDir::separator()
Returns the native directory separator: "/" under Unix (including
Mac OS X) and "\\" under Windows.
See homePath() for details.
- \sa drives(), current(), root(), temp()
+ \sa current(), root(), temp()
*/
/*!
See tempPath() for details.
- \sa drives(), current(), home(), root()
+ \sa current(), home(), root()
*/
/*!
See rootPath() for details.
- \sa drives(), current(), home(), temp()
+ \sa current(), home(), temp()
*/
/*!
For Unix operating systems this returns "/". For Windows and Symbian file
systems this normally returns "c:/". I.E. the root of the system drive.
- \sa root(), drives(), currentPath(), homePath(), tempPath()
+ \sa root(), currentPath(), homePath(), tempPath()
*/
QString QDir::rootPath()
{
bool rename(const QString &oldName, const QString &newName);
bool exists(const QString &name) const;
- static QFileInfoList drives();
-
static bool setCurrent(const QString &path);
static inline QDir current() { return QDir(currentPath()); }
static QString currentPath();
\sa setCurrentPath()
*/
-/*! \fn QFileInfoList QFSFileEngine::drives()
- For Windows, returns the list of drives in the file system as a list
- of QFileInfo objects. On unix, Mac OS X and Windows CE, only the
- root path is returned. On Windows, this function returns all drives
- (A:\, C:\, D:\, etc.).
-
- For Unix, the list contains just the root path "/".
-*/
-
/*! \fn QString QFSFileEngine::fileName(FileName file) const
\reimp
*/
static QString homePath();
static QString rootPath();
static QString tempPath();
- static QFileInfoList drives();
protected:
QFSFileEngine(QFSFileEnginePrivate &dd);
return QFileSystemEngine::tempPath();
}
-QFileInfoList QFSFileEngine::drives()
-{
- QFileInfoList ret;
- ret.append(QFileInfo(rootPath()));
- return ret;
-}
-
bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) const
{
if (!tried_stat || !metaData.hasFlags(flags)) {
return info;
}
-QString QFileInfoGatherer::translateDriveName(const QFileInfo &drive) const
-{
- return drive.absoluteFilePath();
-}
-
/*
Get specific file info's, batch the files so update when we have 100
items and every 200ms after that
#endif
QFileInfoList infoList;
if (files.isEmpty()) {
- infoList = QDir::drives();
+ infoList << QFieInfo(QDir::rootPath());
} else {
for (int i = 0; i < files.count(); ++i)
infoList << QFileInfo(files.at(i));
}
for (int i = infoList.count() - 1; i >= 0; --i) {
- QString driveName = translateDriveName(infoList.at(i));
+ QString driveName = infoList.at(i);
QList<QPair<QString,QFileInfo> > updatedFiles;
- updatedFiles.append(QPair<QString,QFileInfo>(driveName, infoList.at(i)));
+ updatedFiles.append(QPair<QString,QFileInfo>(driveName.absoluteFilePath(), infoList.at(i)));
emit updates(path, updatedFiles);
}
return;
private:
void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path);
- QString translateDriveName(const QFileInfo &drive) const;
QMutex mutex;
QWaitCondition condition;
: QAbstractItemModel(*new QDirModelPrivate, parent)
{
Q_D(QDirModel);
- // we always start with QDir::drives()
+ // we always start with QDir::rootPath()
d->nameFilters = nameFilters.isEmpty() ? QStringList(QLatin1String("*")) : nameFilters;
d->filters = filters;
d->sort = sort;
QFileInfoList infoList;
if (parent == &root) {
parent = 0;
- infoList = QDir::drives();
+ infoList << QFileInfo(QDir::rootPath());
} else if (parent->info.isDir()) {
//resolve directory links only if requested.
if (parent->info.isSymLink() && resolveSymlinks) {