Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | static inline bool _q_isMacHidden(const char *nativePath) | - |
15 | { | - |
16 | (void)nativePath;; | - |
17 | | - |
18 | return false; executed: return false; Execution Count:17996 | 17996 |
19 | } | - |
20 | | - |
21 | | - |
22 | | - |
23 | QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data) | - |
24 | { | - |
25 | char s[4096 +1]; | - |
26 | int len = readlink(link.nativeFilePath().constData(), s, 4096); | - |
27 | | - |
28 | if (len > 0) { partially evaluated: len > 0 yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
29 | QString ret; | - |
30 | if (!data.hasFlags(QFileSystemMetaData::DirectoryType)) evaluated: !data.hasFlags(QFileSystemMetaData::DirectoryType) yes Evaluation Count:6 | yes Evaluation Count:4 |
| 4-6 |
31 | fillMetaData(link, data, QFileSystemMetaData::DirectoryType); executed: fillMetaData(link, data, QFileSystemMetaData::DirectoryType); Execution Count:6 | 6 |
32 | if (data.isDirectory() && s[0] != '/') { evaluated: data.isDirectory() yes Evaluation Count:3 | yes Evaluation Count:7 |
evaluated: s[0] != '/' yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-7 |
33 | QDir parent(link.filePath()); | - |
34 | parent.cdUp(); | - |
35 | ret = parent.path(); | - |
36 | if (!ret.isEmpty() && !ret.endsWith(QLatin1Char('/'))) partially evaluated: !ret.isEmpty() yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !ret.endsWith(QLatin1Char('/')) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
37 | ret += QLatin1Char('/'); executed: ret += QLatin1Char('/'); Execution Count:1 | 1 |
38 | } executed: } Execution Count:1 | 1 |
39 | s[len] = '\0'; | - |
40 | ret += QFile::decodeName(QByteArray(s)); | - |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
45 | if (!ret.startsWith(QLatin1Char('/'))) { evaluated: !ret.startsWith(QLatin1Char('/')) yes Evaluation Count:4 | yes Evaluation Count:6 |
| 4-6 |
46 | if (link.filePath().startsWith(QLatin1Char('/'))) { evaluated: link.filePath().startsWith(QLatin1Char('/')) yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
47 | ret.prepend(link.filePath().left(link.filePath().lastIndexOf(QLatin1Char('/'))) | - |
48 | + QLatin1Char('/')); | - |
49 | } else { executed: } Execution Count:1 | 1 |
50 | ret.prepend(QDir::currentPath() + QLatin1Char('/')); | - |
51 | } executed: } Execution Count:3 | 3 |
52 | } | - |
53 | ret = QDir::cleanPath(ret); | - |
54 | if (ret.size() > 1 && ret.endsWith(QLatin1Char('/'))) partially evaluated: ret.size() > 1 yes Evaluation Count:10 | no Evaluation Count:0 |
partially evaluated: ret.endsWith(QLatin1Char('/')) no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
55 | ret.chop(1); never executed: ret.chop(1); | 0 |
56 | return QFileSystemEntry(ret); executed: return QFileSystemEntry(ret); Execution Count:10 | 10 |
57 | } | - |
58 | return QFileSystemEntry(); never executed: return QFileSystemEntry(); | 0 |
59 | } | - |
60 | | - |
61 | | - |
62 | QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data) | - |
63 | { | - |
64 | if (entry.isEmpty() || entry.isRoot()) partially evaluated: entry.isEmpty() no Evaluation Count:0 | yes Evaluation Count:2130 |
evaluated: entry.isRoot() yes Evaluation Count:62 | yes Evaluation Count:2068 |
| 0-2130 |
65 | return entry; executed: return entry; Execution Count:62 | 62 |
66 | | - |
67 | | - |
68 | | - |
69 | | - |
70 | | - |
71 | | - |
72 | char *ret = 0; | - |
73 | ret = realpath(entry.nativeFilePath().constData(), (char*)0); | - |
74 | if (ret) { evaluated: ret yes Evaluation Count:2055 | yes Evaluation Count:13 |
| 13-2055 |
75 | data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute; | - |
76 | data.entryFlags |= QFileSystemMetaData::ExistsAttribute; | - |
77 | QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); | - |
78 | free(ret); | - |
79 | return QFileSystemEntry(canonicalPath); executed: return QFileSystemEntry(canonicalPath); Execution Count:2055 | 2055 |
80 | } else if ((*__errno_location ()) == 2) { partially evaluated: (*__errno_location ()) == 2 yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
81 | data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute; | - |
82 | data.entryFlags &= ~(QFileSystemMetaData::ExistsAttribute); | - |
83 | return QFileSystemEntry(); executed: return QFileSystemEntry(); Execution Count:13 | 13 |
84 | } | - |
85 | return entry; never executed: return entry; | 0 |
86 | | - |
87 | } | - |
88 | | - |
89 | | - |
90 | QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) | - |
91 | { | - |
92 | if (entry.isAbsolute() && entry.isClean()) evaluated: entry.isAbsolute() yes Evaluation Count:8268 | yes Evaluation Count:542 |
evaluated: entry.isClean() yes Evaluation Count:7883 | yes Evaluation Count:385 |
| 385-8268 |
93 | return entry; executed: return entry; Execution Count:7883 | 7883 |
94 | | - |
95 | QByteArray orig = entry.nativeFilePath(); | - |
96 | QByteArray result; | - |
97 | if (orig.isEmpty() || !orig.startsWith('/')) { partially evaluated: orig.isEmpty() no Evaluation Count:0 | yes Evaluation Count:927 |
evaluated: !orig.startsWith('/') yes Evaluation Count:542 | yes Evaluation Count:385 |
| 0-927 |
98 | QFileSystemEntry cur(currentPath()); | - |
99 | result = cur.nativeFilePath(); | - |
100 | } executed: } Execution Count:542 | 542 |
101 | if (!orig.isEmpty() && !(orig.length() == 1 && orig[0] == '.')) { partially evaluated: !orig.isEmpty() yes Evaluation Count:927 | no Evaluation Count:0 |
evaluated: orig.length() == 1 yes Evaluation Count:186 | yes Evaluation Count:741 |
partially evaluated: orig[0] == '.' yes Evaluation Count:186 | no Evaluation Count:0 |
| 0-927 |
102 | if (!result.isEmpty() && !result.endsWith('/')) evaluated: !result.isEmpty() yes Evaluation Count:356 | yes Evaluation Count:385 |
partially evaluated: !result.endsWith('/') yes Evaluation Count:356 | no Evaluation Count:0 |
| 0-385 |
103 | result.append('/'); executed: result.append('/'); Execution Count:356 | 356 |
104 | result.append(orig); | - |
105 | } executed: } Execution Count:741 | 741 |
106 | | - |
107 | if (result.length() == 1 && result[0] == '/') partially evaluated: result.length() == 1 no Evaluation Count:0 | yes Evaluation Count:927 |
never evaluated: result[0] == '/' | 0-927 |
108 | return QFileSystemEntry(result, QFileSystemEntry::FromNativePath()); never executed: return QFileSystemEntry(result, QFileSystemEntry::FromNativePath()); | 0 |
109 | const bool isDir = result.endsWith('/'); | - |
110 | | - |
111 | | - |
112 | | - |
113 | | - |
114 | | - |
115 | QFileSystemEntry resultingEntry(result, QFileSystemEntry::FromNativePath()); | - |
116 | QString stringVersion = QDir::cleanPath(resultingEntry.filePath()); | - |
117 | if (isDir) evaluated: isDir yes Evaluation Count:2 | yes Evaluation Count:925 |
| 2-925 |
118 | stringVersion.append(QLatin1Char('/')); executed: stringVersion.append(QLatin1Char('/')); Execution Count:2 | 2 |
119 | return QFileSystemEntry(stringVersion); executed: return QFileSystemEntry(stringVersion); Execution Count:927 | 927 |
120 | } | - |
121 | | - |
122 | | - |
123 | QString QFileSystemEngine::resolveUserName(uint userId) | - |
124 | { | - |
125 | | - |
126 | int size_max = sysconf(_SC_GETPW_R_SIZE_MAX); | - |
127 | if (size_max == -1) partially evaluated: size_max == -1 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
128 | size_max = 1024; never executed: size_max = 1024; | 0 |
129 | QVarLengthArray<char, 1024> buf(size_max); | - |
130 | | - |
131 | | - |
132 | struct passwd *pw = 0; | - |
133 | | - |
134 | | - |
135 | struct passwd entry; | - |
136 | getpwuid_r(userId, &entry, buf.data(), buf.size(), &pw); | - |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
141 | if (pw) partially evaluated: pw yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
142 | return QFile::decodeName(QByteArray(pw->pw_name)); executed: return QFile::decodeName(QByteArray(pw->pw_name)); Execution Count:2 | 2 |
143 | return QString(); never executed: return QString(); | 0 |
144 | } | - |
145 | | - |
146 | | - |
147 | QString QFileSystemEngine::resolveGroupName(uint groupId) | - |
148 | { | - |
149 | | - |
150 | int size_max = sysconf(_SC_GETPW_R_SIZE_MAX); | - |
151 | if (size_max == -1) never evaluated: size_max == -1 | 0 |
152 | size_max = 1024; never executed: size_max = 1024; | 0 |
153 | QVarLengthArray<char, 1024> buf(size_max); | - |
154 | | - |
155 | | - |
156 | struct group *gr = 0; | - |
157 | | - |
158 | | - |
159 | size_max = sysconf(_SC_GETGR_R_SIZE_MAX); | - |
160 | if (size_max == -1) never evaluated: size_max == -1 | 0 |
161 | size_max = 1024; never executed: size_max = 1024; | 0 |
162 | buf.resize(size_max); | - |
163 | struct group entry; | - |
164 | | - |
165 | | - |
166 | for (unsigned size = size_max; size < 256000; size += size) never evaluated: size < 256000 | 0 |
167 | { | - |
168 | buf.resize(size); | - |
169 | | - |
170 | if (!getgrgid_r(groupId, &entry, buf.data(), buf.size(), &gr) never evaluated: !getgrgid_r(groupId, &entry, buf.data(), buf.size(), &gr) | 0 |
171 | || (*__errno_location ()) != 34) never evaluated: (*__errno_location ()) != 34 | 0 |
172 | break; | 0 |
173 | } | 0 |
174 | | - |
175 | | - |
176 | | - |
177 | | - |
178 | if (gr) | 0 |
179 | return QFile::decodeName(QByteArray(gr->gr_name)); never executed: return QFile::decodeName(QByteArray(gr->gr_name)); | 0 |
180 | return QString(); never executed: return QString(); | 0 |
181 | } | - |
182 | bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data, | - |
183 | QFileSystemMetaData::MetaDataFlags what) | - |
184 | { | - |
185 | if (what & QFileSystemMetaData::PosixStatFlags) evaluated: what & QFileSystemMetaData::PosixStatFlags yes Evaluation Count:15994 | yes Evaluation Count:31216 |
| 15994-31216 |
186 | what |= QFileSystemMetaData::PosixStatFlags; executed: what |= QFileSystemMetaData::PosixStatFlags; Execution Count:15994 | 15994 |
187 | | - |
188 | if (what & QFileSystemMetaData::ExistsAttribute) { evaluated: what & QFileSystemMetaData::ExistsAttribute yes Evaluation Count:13214 | yes Evaluation Count:33996 |
| 13214-33996 |
189 | | - |
190 | what |= QFileSystemMetaData::PosixStatFlags; | - |
191 | } executed: } Execution Count:13214 | 13214 |
192 | | - |
193 | data.entryFlags &= ~what; | - |
194 | | - |
195 | const char * nativeFilePath; | - |
196 | int nativeFilePathLength; | - |
197 | { | - |
198 | const QByteArray &path = entry.nativeFilePath(); | - |
199 | nativeFilePath = path.constData(); | - |
200 | nativeFilePathLength = path.size(); | - |
201 | (void)nativeFilePathLength;; | - |
202 | } | - |
203 | | - |
204 | bool entryExists = true; | - |
205 | | - |
206 | struct stat64 statBuffer; | - |
207 | bool statBufferValid = false; | - |
208 | if (what & QFileSystemMetaData::LinkType) { evaluated: what & QFileSystemMetaData::LinkType yes Evaluation Count:7149 | yes Evaluation Count:40062 |
| 7149-40062 |
209 | if (::lstat64(nativeFilePath, &statBuffer) == 0) { evaluated: ::lstat64(nativeFilePath, &statBuffer) == 0 yes Evaluation Count:3995 | yes Evaluation Count:3154 |
| 3154-3995 |
210 | if (((((statBuffer.st_mode)) & 0170000) == (0120000))) { evaluated: ((((statBuffer.st_mode)) & 0170000) == (0120000)) yes Evaluation Count:64 | yes Evaluation Count:3931 |
| 64-3931 |
211 | data.entryFlags |= QFileSystemMetaData::LinkType; | - |
212 | } else { executed: } Execution Count:64 | 64 |
213 | statBufferValid = true; | - |
214 | data.entryFlags &= ~QFileSystemMetaData::PosixStatFlags; | - |
215 | } executed: } Execution Count:3931 | 3931 |
216 | } else { | - |
217 | entryExists = false; | - |
218 | } executed: } Execution Count:3154 | 3154 |
219 | | - |
220 | data.knownFlagsMask |= QFileSystemMetaData::LinkType; | - |
221 | } executed: } Execution Count:7149 | 7149 |
222 | | - |
223 | if (statBufferValid || (what & QFileSystemMetaData::PosixStatFlags)) { evaluated: statBufferValid yes Evaluation Count:3931 | yes Evaluation Count:43280 |
evaluated: (what & QFileSystemMetaData::PosixStatFlags) yes Evaluation Count:24835 | yes Evaluation Count:18445 |
| 3931-43280 |
224 | if (entryExists && !statBufferValid) evaluated: entryExists yes Evaluation Count:25612 | yes Evaluation Count:3154 |
evaluated: !statBufferValid yes Evaluation Count:21681 | yes Evaluation Count:3931 |
| 3154-25612 |
225 | statBufferValid = (::stat64(nativeFilePath, &statBuffer) == 0); executed: statBufferValid = (::stat64(nativeFilePath, &statBuffer) == 0); Execution Count:21681 | 21681 |
226 | | - |
227 | if (statBufferValid) evaluated: statBufferValid yes Evaluation Count:20383 | yes Evaluation Count:8383 |
| 8383-20383 |
228 | data.fillFromStatBuf(statBuffer); executed: data.fillFromStatBuf(statBuffer); Execution Count:20383 | 20383 |
229 | else { | - |
230 | entryExists = false; | - |
231 | data.creationTime_ = 0; | - |
232 | data.modificationTime_ = 0; | - |
233 | data.accessTime_ = 0; | - |
234 | data.size_ = 0; | - |
235 | data.userId_ = (uint) -2; | - |
236 | data.groupId_ = (uint) -2; | - |
237 | } executed: } Execution Count:8383 | 8383 |
238 | | - |
239 | | - |
240 | data.knownFlagsMask |= QFileSystemMetaData::PosixStatFlags | - |
241 | | QFileSystemMetaData::ExistsAttribute; | - |
242 | } executed: } Execution Count:28765 | 28765 |
243 | if (what & QFileSystemMetaData::UserPermissions) { evaluated: what & QFileSystemMetaData::UserPermissions yes Evaluation Count:2590 | yes Evaluation Count:44620 |
| 2590-44620 |
244 | | - |
245 | | - |
246 | if (entryExists) { partially evaluated: entryExists yes Evaluation Count:2590 | no Evaluation Count:0 |
| 0-2590 |
247 | if (what & QFileSystemMetaData::UserReadPermission) { evaluated: what & QFileSystemMetaData::UserReadPermission yes Evaluation Count:2571 | yes Evaluation Count:19 |
| 19-2571 |
248 | if (::access(nativeFilePath, 4) == 0) evaluated: ::access(nativeFilePath, 4) == 0 yes Evaluation Count:2525 | yes Evaluation Count:46 |
| 46-2525 |
249 | data.entryFlags |= QFileSystemMetaData::UserReadPermission; executed: data.entryFlags |= QFileSystemMetaData::UserReadPermission; Execution Count:2525 | 2525 |
250 | } executed: } Execution Count:2571 | 2571 |
251 | if (what & QFileSystemMetaData::UserWritePermission) { evaluated: what & QFileSystemMetaData::UserWritePermission yes Evaluation Count:2473 | yes Evaluation Count:117 |
| 117-2473 |
252 | if (::access(nativeFilePath, 2) == 0) evaluated: ::access(nativeFilePath, 2) == 0 yes Evaluation Count:1954 | yes Evaluation Count:519 |
| 519-1954 |
253 | data.entryFlags |= QFileSystemMetaData::UserWritePermission; executed: data.entryFlags |= QFileSystemMetaData::UserWritePermission; Execution Count:1954 | 1954 |
254 | } executed: } Execution Count:2473 | 2473 |
255 | if (what & QFileSystemMetaData::UserExecutePermission) { evaluated: what & QFileSystemMetaData::UserExecutePermission yes Evaluation Count:2478 | yes Evaluation Count:112 |
| 112-2478 |
256 | if (::access(nativeFilePath, 1) == 0) evaluated: ::access(nativeFilePath, 1) == 0 yes Evaluation Count:1737 | yes Evaluation Count:741 |
| 741-1737 |
257 | data.entryFlags |= QFileSystemMetaData::UserExecutePermission; executed: data.entryFlags |= QFileSystemMetaData::UserExecutePermission; Execution Count:1737 | 1737 |
258 | } executed: } Execution Count:2478 | 2478 |
259 | } executed: } Execution Count:2590 | 2590 |
260 | data.knownFlagsMask |= (what & QFileSystemMetaData::UserPermissions); | - |
261 | } executed: } Execution Count:2590 | 2590 |
262 | | - |
263 | if (what & QFileSystemMetaData::HiddenAttribute evaluated: what & QFileSystemMetaData::HiddenAttribute yes Evaluation Count:22879 | yes Evaluation Count:24331 |
| 22879-24331 |
264 | && !data.isHidden()) { partially evaluated: !data.isHidden() yes Evaluation Count:22879 | no Evaluation Count:0 |
| 0-22879 |
265 | QString fileName = entry.fileName(); | - |
266 | if ((fileName.size() > 0 && fileName.at(0) == QLatin1Char('.')) partially evaluated: fileName.size() > 0 yes Evaluation Count:22879 | no Evaluation Count:0 |
evaluated: fileName.at(0) == QLatin1Char('.') yes Evaluation Count:1729 | yes Evaluation Count:21150 |
| 0-22879 |
267 | || (entryExists && _q_isMacHidden(nativeFilePath))) evaluated: entryExists yes Evaluation Count:17996 | yes Evaluation Count:3154 |
partially evaluated: _q_isMacHidden(nativeFilePath) no Evaluation Count:0 | yes Evaluation Count:17996 |
| 0-17996 |
268 | data.entryFlags |= QFileSystemMetaData::HiddenAttribute; executed: data.entryFlags |= QFileSystemMetaData::HiddenAttribute; Execution Count:1729 | 1729 |
269 | data.knownFlagsMask |= QFileSystemMetaData::HiddenAttribute; | - |
270 | } executed: } Execution Count:22879 | 22879 |
271 | if (!entryExists) { evaluated: !entryExists yes Evaluation Count:8383 | yes Evaluation Count:38828 |
| 8383-38828 |
272 | data.clearFlags(what); | - |
273 | return false; executed: return false; Execution Count:8382 | 8382 |
274 | } | - |
275 | return data.hasFlags(what); executed: return data.hasFlags(what); Execution Count:38828 | 38828 |
276 | } | - |
277 | | - |
278 | | - |
279 | bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool createParents) | - |
280 | { | - |
281 | QString dirName = entry.filePath(); | - |
282 | if (createParents) { evaluated: createParents yes Evaluation Count:211 | yes Evaluation Count:1320 |
| 211-1320 |
283 | dirName = QDir::cleanPath(dirName); | - |
284 | for (int oldslash = -1, slash=0; slash != -1; oldslash = slash) { partially evaluated: slash != -1 yes Evaluation Count:1187 | no Evaluation Count:0 |
| 0-1187 |
285 | slash = dirName.indexOf(QDir::separator(), oldslash+1); | - |
286 | if (slash == -1) { evaluated: slash == -1 yes Evaluation Count:422 | yes Evaluation Count:765 |
| 422-765 |
287 | if (oldslash == dirName.length()) evaluated: oldslash == dirName.length() yes Evaluation Count:211 | yes Evaluation Count:211 |
| 211 |
288 | break; executed: break; Execution Count:211 | 211 |
289 | slash = dirName.length(); | - |
290 | } executed: } Execution Count:211 | 211 |
291 | if (slash) { evaluated: slash yes Evaluation Count:766 | yes Evaluation Count:210 |
| 210-766 |
292 | const QByteArray chunk = QFile::encodeName(dirName.left(slash)); | - |
293 | struct stat64 st; | - |
294 | if (::stat64(chunk.constData(), &st) != -1) { evaluated: ::stat64(chunk.constData(), &st) != -1 yes Evaluation Count:508 | yes Evaluation Count:258 |
| 258-508 |
295 | if ((st.st_mode & 0170000) != 0040000) partially evaluated: (st.st_mode & 0170000) != 0040000 no Evaluation Count:0 | yes Evaluation Count:508 |
| 0-508 |
296 | return false; never executed: return false; | 0 |
297 | } else if (::mkdir(chunk.constData(), 0777) != 0) { partially evaluated: ::mkdir(chunk.constData(), 0777) != 0 no Evaluation Count:0 | yes Evaluation Count:258 |
executed: } Execution Count:508 | 0-508 |
298 | return false; never executed: return false; | 0 |
299 | } | - |
300 | } | - |
301 | } executed: } Execution Count:976 | 976 |
302 | return true; executed: return true; Execution Count:211 | 211 |
303 | } | - |
304 | | - |
305 | | - |
306 | | - |
307 | | - |
308 | return (::mkdir(QFile::encodeName(dirName).constData(), 0777) == 0); executed: return (::mkdir(QFile::encodeName(dirName).constData(), 0777) == 0); Execution Count:1320 | 1320 |
309 | } | - |
310 | | - |
311 | | - |
312 | bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool removeEmptyParents) | - |
313 | { | - |
314 | if (removeEmptyParents) { evaluated: removeEmptyParents yes Evaluation Count:4 | yes Evaluation Count:2372 |
| 4-2372 |
315 | QString dirName = QDir::cleanPath(entry.filePath()); | - |
316 | for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) { partially evaluated: slash > 0 yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
317 | const QByteArray chunk = QFile::encodeName(dirName.left(slash)); | - |
318 | struct stat64 st; | - |
319 | if (::stat64(chunk.constData(), &st) != -1) { evaluated: ::stat64(chunk.constData(), &st) != -1 yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
320 | if ((st.st_mode & 0170000) != 0040000) partially evaluated: (st.st_mode & 0170000) != 0040000 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
321 | return false; never executed: return false; | 0 |
322 | if (::rmdir(chunk.constData()) != 0) evaluated: ::rmdir(chunk.constData()) != 0 yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
323 | return oldslash != 0; executed: return oldslash != 0; Execution Count:1 | 1 |
324 | } else { executed: } Execution Count:3 | 3 |
325 | return false; executed: return false; Execution Count:3 | 3 |
326 | } | - |
327 | slash = dirName.lastIndexOf(QDir::separator(), oldslash-1); | - |
328 | } executed: } Execution Count:3 | 3 |
329 | return true; never executed: return true; | 0 |
330 | } | - |
331 | return rmdir(QFile::encodeName(entry.filePath()).constData()) == 0; executed: return rmdir(QFile::encodeName(entry.filePath()).constData()) == 0; Execution Count:2372 | 2372 |
332 | } | - |
333 | | - |
334 | | - |
335 | bool QFileSystemEngine::createLink(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error) | - |
336 | { | - |
337 | if (::symlink(source.nativeFilePath().constData(), target.nativeFilePath().constData()) == 0) partially evaluated: ::symlink(source.nativeFilePath().constData(), target.nativeFilePath().constData()) == 0 yes Evaluation Count:145 | no Evaluation Count:0 |
| 0-145 |
338 | return true; executed: return true; Execution Count:145 | 145 |
339 | error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError); | - |
340 | return false; never executed: return false; | 0 |
341 | } | - |
342 | | - |
343 | | - |
344 | bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error) | - |
345 | { | - |
346 | (void)source;; | - |
347 | (void)target;; | - |
348 | error = QSystemError(38, QSystemError::StandardLibraryError); | - |
349 | return false; executed: return false; Execution Count:96 | 96 |
350 | } | - |
351 | | - |
352 | | - |
353 | bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error) | - |
354 | { | - |
355 | if (::rename(source.nativeFilePath().constData(), target.nativeFilePath().constData()) == 0) evaluated: ::rename(source.nativeFilePath().constData(), target.nativeFilePath().constData()) == 0 yes Evaluation Count:199 | yes Evaluation Count:4 |
| 4-199 |
356 | return true; executed: return true; Execution Count:199 | 199 |
357 | error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError); | - |
358 | return false; executed: return false; Execution Count:4 | 4 |
359 | } | - |
360 | | - |
361 | | - |
362 | bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError &error) | - |
363 | { | - |
364 | if (unlink(entry.nativeFilePath().constData()) == 0) evaluated: unlink(entry.nativeFilePath().constData()) == 0 yes Evaluation Count:4879 | yes Evaluation Count:613 |
| 613-4879 |
365 | return true; executed: return true; Execution Count:4879 | 4879 |
366 | error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError); | - |
367 | return false; executed: return false; Execution Count:613 | 613 |
368 | | - |
369 | } | - |
370 | | - |
371 | | - |
372 | bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data) | - |
373 | { | - |
374 | mode_t mode = 0; | - |
375 | if (permissions & QFile::ReadOwner) evaluated: permissions & QFile::ReadOwner yes Evaluation Count:494 | yes Evaluation Count:21 |
| 21-494 |
376 | mode |= 0400; executed: mode |= 0400; Execution Count:494 | 494 |
377 | if (permissions & QFile::WriteOwner) evaluated: permissions & QFile::WriteOwner yes Evaluation Count:442 | yes Evaluation Count:73 |
| 73-442 |
378 | mode |= 0200; executed: mode |= 0200; Execution Count:442 | 442 |
379 | if (permissions & QFile::ExeOwner) evaluated: permissions & QFile::ExeOwner yes Evaluation Count:220 | yes Evaluation Count:295 |
| 220-295 |
380 | mode |= 0100; executed: mode |= 0100; Execution Count:220 | 220 |
381 | if (permissions & QFile::ReadUser) evaluated: permissions & QFile::ReadUser yes Evaluation Count:476 | yes Evaluation Count:39 |
| 39-476 |
382 | mode |= 0400; executed: mode |= 0400; Execution Count:476 | 476 |
383 | if (permissions & QFile::WriteUser) evaluated: permissions & QFile::WriteUser yes Evaluation Count:427 | yes Evaluation Count:88 |
| 88-427 |
384 | mode |= 0200; executed: mode |= 0200; Execution Count:427 | 427 |
385 | if (permissions & QFile::ExeUser) evaluated: permissions & QFile::ExeUser yes Evaluation Count:220 | yes Evaluation Count:295 |
| 220-295 |
386 | mode |= 0100; executed: mode |= 0100; Execution Count:220 | 220 |
387 | if (permissions & QFile::ReadGroup) evaluated: permissions & QFile::ReadGroup yes Evaluation Count:214 | yes Evaluation Count:301 |
| 214-301 |
388 | mode |= (0400 >> 3); executed: mode |= (0400 >> 3); Execution Count:214 | 214 |
389 | if (permissions & QFile::WriteGroup) partially evaluated: permissions & QFile::WriteGroup no Evaluation Count:0 | yes Evaluation Count:515 |
| 0-515 |
390 | mode |= (0200 >> 3); never executed: mode |= (0200 >> 3); | 0 |
391 | if (permissions & QFile::ExeGroup) evaluated: permissions & QFile::ExeGroup yes Evaluation Count:1 | yes Evaluation Count:514 |
| 1-514 |
392 | mode |= (0100 >> 3); executed: mode |= (0100 >> 3); Execution Count:1 | 1 |
393 | if (permissions & QFile::ReadOther) evaluated: permissions & QFile::ReadOther yes Evaluation Count:219 | yes Evaluation Count:296 |
| 219-296 |
394 | mode |= ((0400 >> 3) >> 3); executed: mode |= ((0400 >> 3) >> 3); Execution Count:219 | 219 |
395 | if (permissions & QFile::WriteOther) evaluated: permissions & QFile::WriteOther yes Evaluation Count:218 | yes Evaluation Count:297 |
| 218-297 |
396 | mode |= ((0200 >> 3) >> 3); executed: mode |= ((0200 >> 3) >> 3); Execution Count:218 | 218 |
397 | if (permissions & QFile::ExeOther) evaluated: permissions & QFile::ExeOther yes Evaluation Count:2 | yes Evaluation Count:513 |
| 2-513 |
398 | mode |= ((0100 >> 3) >> 3); executed: mode |= ((0100 >> 3) >> 3); Execution Count:2 | 2 |
399 | | - |
400 | bool success = ::chmod(entry.nativeFilePath().constData(), mode) == 0; | - |
401 | if (success && data) { evaluated: success yes Evaluation Count:510 | yes Evaluation Count:5 |
partially evaluated: data no Evaluation Count:0 | yes Evaluation Count:510 |
| 0-510 |
402 | data->entryFlags &= ~QFileSystemMetaData::Permissions; | - |
403 | data->entryFlags |= QFileSystemMetaData::MetaDataFlag(uint(permissions)); | - |
404 | data->knownFlagsMask |= QFileSystemMetaData::Permissions; | - |
405 | } | 0 |
406 | if (!success) evaluated: !success yes Evaluation Count:5 | yes Evaluation Count:510 |
| 5-510 |
407 | error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError); executed: error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError); Execution Count:5 | 5 |
408 | return success; executed: return success; Execution Count:515 | 515 |
409 | } | - |
410 | | - |
411 | QString QFileSystemEngine::homePath() | - |
412 | { | - |
413 | QString home = QFile::decodeName(qgetenv("HOME")); | - |
414 | if (home.isNull()) partially evaluated: home.isNull() no Evaluation Count:0 | yes Evaluation Count:732 |
| 0-732 |
415 | home = rootPath(); never executed: home = rootPath(); | 0 |
416 | return QDir::cleanPath(home); executed: return QDir::cleanPath(home); Execution Count:732 | 732 |
417 | } | - |
418 | | - |
419 | QString QFileSystemEngine::rootPath() | - |
420 | { | - |
421 | return QLatin1String("/"); executed: return QLatin1String("/"); Execution Count:176 | 176 |
422 | } | - |
423 | | - |
424 | QString QFileSystemEngine::tempPath() | - |
425 | { | - |
426 | QString temp = QFile::decodeName(qgetenv("TMPDIR")); | - |
427 | if (temp.isEmpty()) partially evaluated: temp.isEmpty() yes Evaluation Count:2927 | no Evaluation Count:0 |
| 0-2927 |
428 | temp = QLatin1String("/tmp/"); executed: temp = QLatin1String("/tmp/"); Execution Count:2927 | 2927 |
429 | return QDir::cleanPath(temp); executed: return QDir::cleanPath(temp); Execution Count:2927 | 2927 |
430 | | - |
431 | } | - |
432 | | - |
433 | bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &path) | - |
434 | { | - |
435 | int r; | - |
436 | r = ::chdir(path.nativeFilePath().constData()); | - |
437 | return r >= 0; executed: return r >= 0; Execution Count:296 | 296 |
438 | } | - |
439 | | - |
440 | QFileSystemEntry QFileSystemEngine::currentPath() | - |
441 | { | - |
442 | QFileSystemEntry result; | - |
443 | struct stat64 st; | - |
444 | if (::stat64(".", &st) == 0) { partially evaluated: ::stat64(".", &st) == 0 yes Evaluation Count:1327 | no Evaluation Count:0 |
| 0-1327 |
445 | | - |
446 | | - |
447 | | - |
448 | | - |
449 | | - |
450 | | - |
451 | | - |
452 | char currentName[4096 +1]; | - |
453 | if (::getcwd(currentName, 4096)) partially evaluated: ::getcwd(currentName, 4096) yes Evaluation Count:1327 | no Evaluation Count:0 |
| 0-1327 |
454 | result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath()); executed: result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath()); Execution Count:1327 | 1327 |
455 | | - |
456 | | - |
457 | | - |
458 | | - |
459 | | - |
460 | } else { executed: } Execution Count:1327 | 1327 |
461 | | - |
462 | | - |
463 | | - |
464 | } | 0 |
465 | return result; executed: return result; Execution Count:1327 | 1327 |
466 | } | - |
467 | | - |
468 | | - |
| | |