-rw-r--r-- | qmake/tools/qfileinfo.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/qmake/tools/qfileinfo.cpp b/qmake/tools/qfileinfo.cpp index 3af7932..a78f4fa 100644 --- a/qmake/tools/qfileinfo.cpp +++ b/qmake/tools/qfileinfo.cpp @@ -510,150 +510,152 @@ bool QFileInfo::isHidden() const } #endif /*! Returns TRUE if the file path name is relative. Returns FALSE if the path is absolute (e.g. under Unix a path is absolute if it begins with a "/"). */ #ifndef QT_NO_DIR bool QFileInfo::isRelative() const { return QDir::isRelativePath( fn ); } /*! Converts the file's path to an absolute path. If it is already absolute, nothing is done. \sa filePath(), isRelative() */ bool QFileInfo::convertToAbs() { if ( isRelative() ) fn = absFilePath(); return QDir::isRelativePath( fn ); } #endif /*! Returns the file size in bytes, or 0 if the file does not exist or if the size is 0 or if the size cannot be fetched. */ #if defined(QT_ABI_QT4) QIODevice::Offset QFileInfo::size() const #else uint QFileInfo::size() const #endif { if ( !fic || !cache ) doStat(); if ( fic ) #if defined(QT_ABI_QT4) return (QIODevice::Offset)fic->st.st_size; #elif defined(QT_LARGEFILE_SUPPORT) return (uint)fic->st.st_size > UINT_MAX ? UINT_MAX : (uint)fic->st.st_size; #else return (uint)fic->st.st_size; #endif else return 0; } /*! Returns the date and time when the file was created. On platforms where this information is not available, returns the same as lastModified(). \sa created() lastModified() lastRead() */ QDateTime QFileInfo::created() const { QDateTime dt; if ( !fic || !cache ) doStat(); if ( fic && fic->st.st_ctime != 0 ) { dt.setTime_t( fic->st.st_ctime ); return dt; } else { return lastModified(); } } /*! Returns the date and time when the file was last modified. \sa created() lastModified() lastRead() */ QDateTime QFileInfo::lastModified() const { QDateTime dt; if ( !fic || !cache ) doStat(); if ( fic ) dt.setTime_t( fic->st.st_mtime ); return dt; } /*! Returns the date and time when the file was last read (accessed). On platforms where this information is not available, returns the same as lastModified(). \sa created() lastModified() lastRead() */ QDateTime QFileInfo::lastRead() const { QDateTime dt; if ( !fic || !cache ) doStat(); if ( fic && fic->st.st_atime != 0 ) { dt.setTime_t( fic->st.st_atime ); return dt; } else { return lastModified(); } } #ifndef QT_NO_DIR /*! Returns the absolute path including the file name. The absolute path name consists of the full path and the file name. On Unix this will always begin with the root, '/', directory. On Windows this will always begin 'D:/' where D is a drive letter, except for network shares that are not mapped to a drive letter, in which case the path will begin '//sharename/'. This function returns the same as filePath(), unless isRelative() is TRUE. + If the QFileInfo is empty it returns QDir::currentDirPath(). + This function can be time consuming under Unix (in the order of milliseconds). \sa isRelative(), filePath() */ QString QFileInfo::absFilePath() const { QString tmp; if ( QDir::isRelativePath(fn) -#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) +#if defined(Q_OS_WIN32) && fn[1] != ':' #endif ) { tmp = QDir::currentDirPath(); tmp += '/'; } tmp += fn; makeAbs( tmp ); return QDir::cleanDirPath( tmp ); } #endif |