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