author | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
commit | 155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff) | |
tree | e6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/tools/qfileinfo_unix.cpp | |
parent | 86703e8a5527ef114facd02c005b6b3a7e62e263 (diff) | |
download | opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2 |
update qmake to 1.05a
Diffstat (limited to 'qmake/tools/qfileinfo_unix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/tools/qfileinfo_unix.cpp | 4 |
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 | |||
169 | do not have groups, or if an error occurs, QString::null is | 169 | do not have groups, or if an error occurs, QString::null is |
170 | returned. | 170 | returned. |
171 | 171 | ||
172 | This function can be time consuming under Unix (in the order of | 172 | This function can be time consuming under Unix (in the order of |
173 | milliseconds). | 173 | milliseconds). |
174 | 174 | ||
175 | \sa groupId(), owner(), ownerId() | 175 | \sa groupId(), owner(), ownerId() |
176 | */ | 176 | */ |
177 | 177 | ||
178 | QString QFileInfo::group() const | 178 | QString QFileInfo::group() const |
179 | { | 179 | { |
180 | struct group *gr = getgrgid( groupId() ); | 180 | struct group *gr = getgrgid( groupId() ); |
181 | if ( gr ) | 181 | if ( gr ) |
182 | return QFile::decodeName( gr->gr_name ); | 182 | return QFile::decodeName( gr->gr_name ); |
183 | return QString::null; | 183 | return QString::null; |
184 | } | 184 | } |
185 | 185 | ||
186 | /*! | 186 | /*! |
187 | Returns the id of the group the file belongs to. | 187 | Returns the id of the group the file belongs to. |
188 | 188 | ||
189 | On Windows and on systems where files do not have groups this | 189 | On Windows and on systems where files do not have groups this |
190 | function always returns (uint) -2. | 190 | function always returns (uint) -2. |
191 | 191 | ||
192 | \sa group(), owner(), ownerId() | 192 | \sa group(), owner(), ownerId() |
193 | */ | 193 | */ |
194 | 194 | ||
195 | uint QFileInfo::groupId() const | 195 | uint QFileInfo::groupId() const |
196 | { | 196 | { |
197 | if ( !fic || !cache ) | 197 | if ( !fic || !cache ) |
198 | doStat(); | 198 | doStat(); |
199 | if ( fic ) | 199 | if ( fic ) |
200 | return fic->st.st_gid; | 200 | return fic->st.st_gid; |
201 | return nobodyID; | 201 | return nobodyID; |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | /*! | 205 | /*! |
206 | Tests for file permissions. The \a permissionSpec argument can be | 206 | Tests for file permissions. The \a permissionSpec argument can be |
207 | several flags of type \c PermissionSpec OR-ed together to check | 207 | several flags of type \c PermissionSpec OR-ed together to check |
208 | for permission combinations. | 208 | for permission combinations. |
209 | 209 | ||
210 | On systems where files do not have permissions this function | 210 | On systems where files do not have permissions this function |
211 | always returns TRUE. | 211 | always returns TRUE. |
212 | 212 | ||
213 | Example: | 213 | Example: |
214 | \code | 214 | \code |
215 | QFileInfo fi( "/tmp/archive.tar.gz" ); | 215 | QFileInfo fi( "/tmp/archive.tar.gz" ); |
216 | if ( fi.permission( QFileInfo::WriteUser | QFileInfo::ReadGroup ) ) | 216 | if ( fi.permission( QFileInfo::WriteUser | QFileInfo::ReadGroup ) ) |
217 | qWarning( "I can change the file; my group can read the file."); | 217 | qWarning( "I can change the file; my group can read the file" ); |
218 | if ( fi.permission( QFileInfo::WriteGroup | QFileInfo::WriteOther ) ) | 218 | if ( fi.permission( QFileInfo::WriteGroup | QFileInfo::WriteOther ) ) |
219 | qWarning( "The group or others can change the file!" ); | 219 | qWarning( "The group or others can change the file" ); |
220 | \endcode | 220 | \endcode |
221 | 221 | ||
222 | \sa isReadable(), isWritable(), isExecutable() | 222 | \sa isReadable(), isWritable(), isExecutable() |
223 | */ | 223 | */ |
224 | 224 | ||
225 | bool QFileInfo::permission( int permissionSpec ) const | 225 | bool QFileInfo::permission( int permissionSpec ) const |
226 | { | 226 | { |
227 | if ( !fic || !cache ) | 227 | if ( !fic || !cache ) |
228 | doStat(); | 228 | doStat(); |
229 | if ( fic ) { | 229 | if ( fic ) { |
230 | uint mask = 0; | 230 | uint mask = 0; |
231 | if ( permissionSpec & ReadUser ) | 231 | if ( permissionSpec & ReadUser ) |
232 | mask |= S_IRUSR; | 232 | mask |= S_IRUSR; |
233 | if ( permissionSpec & WriteUser ) | 233 | if ( permissionSpec & WriteUser ) |
234 | mask |= S_IWUSR; | 234 | mask |= S_IWUSR; |
235 | if ( permissionSpec & ExeUser ) | 235 | if ( permissionSpec & ExeUser ) |
236 | mask |= S_IXUSR; | 236 | mask |= S_IXUSR; |
237 | if ( permissionSpec & ReadGroup ) | 237 | if ( permissionSpec & ReadGroup ) |
238 | mask |= S_IRGRP; | 238 | mask |= S_IRGRP; |
239 | if ( permissionSpec & WriteGroup ) | 239 | if ( permissionSpec & WriteGroup ) |
240 | mask |= S_IWGRP; | 240 | mask |= S_IWGRP; |
241 | if ( permissionSpec & ExeGroup ) | 241 | if ( permissionSpec & ExeGroup ) |
242 | mask |= S_IXGRP; | 242 | mask |= S_IXGRP; |
243 | if ( permissionSpec & ReadOther ) | 243 | if ( permissionSpec & ReadOther ) |
244 | mask |= S_IROTH; | 244 | mask |= S_IROTH; |
245 | if ( permissionSpec & WriteOther ) | 245 | if ( permissionSpec & WriteOther ) |
246 | mask |= S_IWOTH; | 246 | mask |= S_IWOTH; |
247 | if ( permissionSpec & ExeOther ) | 247 | if ( permissionSpec & ExeOther ) |
248 | mask |= S_IXOTH; | 248 | mask |= S_IXOTH; |
249 | if ( mask ) { | 249 | if ( mask ) { |
250 | return (fic->st.st_mode & mask) == mask; | 250 | return (fic->st.st_mode & mask) == mask; |
251 | } else { | 251 | } else { |
252 | #if defined(QT_CHECK_NULL) | 252 | #if defined(QT_CHECK_NULL) |
253 | qWarning( "QFileInfo::permission: permissionSpec is 0" ); | 253 | qWarning( "QFileInfo::permission: permissionSpec is 0" ); |
254 | #endif | 254 | #endif |
255 | return TRUE; | 255 | return TRUE; |
256 | } | 256 | } |
257 | } else { | 257 | } else { |
258 | return FALSE; | 258 | return FALSE; |
259 | } | 259 | } |
260 | } | 260 | } |
261 | 261 | ||
262 | void QFileInfo::doStat() const | 262 | void QFileInfo::doStat() const |
263 | { | 263 | { |
264 | QFileInfo *that = ((QFileInfo*)this);// mutable function | 264 | QFileInfo *that = ((QFileInfo*)this);// mutable function |
265 | if ( !that->fic ) | 265 | if ( !that->fic ) |
266 | that->fic = new QFileInfoCache; | 266 | that->fic = new QFileInfoCache; |
267 | that->symLink = FALSE; | 267 | that->symLink = FALSE; |