summaryrefslogtreecommitdiff
path: root/qmake/tools/qfileinfo_unix.cpp
Side-by-side diff
Diffstat (limited to 'qmake/tools/qfileinfo_unix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/tools/qfileinfo_unix.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/qmake/tools/qfileinfo_unix.cpp b/qmake/tools/qfileinfo_unix.cpp
index f7c3a97..364f219 100644
--- a/qmake/tools/qfileinfo_unix.cpp
+++ b/qmake/tools/qfileinfo_unix.cpp
@@ -169,99 +169,99 @@ uint QFileInfo::ownerId() const
do not have groups, or if an error occurs, QString::null is
returned.
This function can be time consuming under Unix (in the order of
milliseconds).
\sa groupId(), owner(), ownerId()
*/
QString QFileInfo::group() const
{
struct group *gr = getgrgid( groupId() );
if ( gr )
return QFile::decodeName( gr->gr_name );
return QString::null;
}
/*!
Returns the id of the group the file belongs to.
On Windows and on systems where files do not have groups this
function always returns (uint) -2.
\sa group(), owner(), ownerId()
*/
uint QFileInfo::groupId() const
{
if ( !fic || !cache )
doStat();
if ( fic )
return fic->st.st_gid;
return nobodyID;
}
/*!
Tests for file permissions. The \a permissionSpec argument can be
several flags of type \c PermissionSpec OR-ed together to check
for permission combinations.
On systems where files do not have permissions this function
always returns TRUE.
Example:
\code
QFileInfo fi( "/tmp/archive.tar.gz" );
if ( fi.permission( QFileInfo::WriteUser | QFileInfo::ReadGroup ) )
- qWarning( "I can change the file; my group can read the file.");
+ qWarning( "I can change the file; my group can read the file" );
if ( fi.permission( QFileInfo::WriteGroup | QFileInfo::WriteOther ) )
- qWarning( "The group or others can change the file!" );
+ qWarning( "The group or others can change the file" );
\endcode
\sa isReadable(), isWritable(), isExecutable()
*/
bool QFileInfo::permission( int permissionSpec ) const
{
if ( !fic || !cache )
doStat();
if ( fic ) {
uint mask = 0;
if ( permissionSpec & ReadUser )
mask |= S_IRUSR;
if ( permissionSpec & WriteUser )
mask |= S_IWUSR;
if ( permissionSpec & ExeUser )
mask |= S_IXUSR;
if ( permissionSpec & ReadGroup )
mask |= S_IRGRP;
if ( permissionSpec & WriteGroup )
mask |= S_IWGRP;
if ( permissionSpec & ExeGroup )
mask |= S_IXGRP;
if ( permissionSpec & ReadOther )
mask |= S_IROTH;
if ( permissionSpec & WriteOther )
mask |= S_IWOTH;
if ( permissionSpec & ExeOther )
mask |= S_IXOTH;
if ( mask ) {
return (fic->st.st_mode & mask) == mask;
} else {
#if defined(QT_CHECK_NULL)
qWarning( "QFileInfo::permission: permissionSpec is 0" );
#endif
return TRUE;
}
} else {
return FALSE;
}
}
void QFileInfo::doStat() const
{
QFileInfo *that = ((QFileInfo*)this); // mutable function
if ( !that->fic )
that->fic = new QFileInfoCache;
that->symLink = FALSE;