Changeset View
Changeset View
Standalone View
Standalone View
krArc/krarc.cpp
Show First 20 Lines • Show All 1156 Lines • ▼ Show 20 Line(s) | |||||
1157 | } | 1157 | } | ||
1158 | 1158 | | |||
1159 | mode_t kio_krarcProtocol::parsePermString(QString perm) | 1159 | mode_t kio_krarcProtocol::parsePermString(QString perm) | ||
1160 | { | 1160 | { | ||
1161 | KRFUNC; | 1161 | KRFUNC; | ||
1162 | mode_t mode = 0; | 1162 | mode_t mode = 0; | ||
1163 | // file type | 1163 | // file type | ||
1164 | if (perm[0] == 'd') mode |= S_IFDIR; | 1164 | if (perm[0] == 'd') mode |= S_IFDIR; | ||
1165 | #ifndef Q_WS_WIN | 1165 | #ifndef Q_OS_WIN | ||
1166 | if (perm[0] == 'l') mode |= S_IFLNK; | 1166 | if (perm[0] == 'l') mode |= S_IFLNK; | ||
1167 | #endif | 1167 | #endif | ||
1168 | if (perm[0] == '-') mode |= S_IFREG; | 1168 | if (perm[0] == '-') mode |= S_IFREG; | ||
1169 | // owner permissions | 1169 | // owner permissions | ||
1170 | if (perm[1] != '-') mode |= S_IRUSR; | 1170 | if (perm[1] != '-') mode |= S_IRUSR; | ||
1171 | if (perm[2] != '-') mode |= S_IWUSR; | 1171 | if (perm[2] != '-') mode |= S_IWUSR; | ||
1172 | if (perm[3] != '-') mode |= S_IXUSR; | 1172 | if (perm[3] != '-') mode |= S_IXUSR; | ||
1173 | #ifndef Q_WS_WIN | 1173 | #ifndef Q_OS_WIN | ||
1174 | // group permissions | 1174 | // group permissions | ||
1175 | if (perm[4] != '-') mode |= S_IRGRP; | 1175 | if (perm[4] != '-') mode |= S_IRGRP; | ||
1176 | if (perm[5] != '-') mode |= S_IWGRP; | 1176 | if (perm[5] != '-') mode |= S_IWGRP; | ||
1177 | if (perm[6] != '-') mode |= S_IXGRP; | 1177 | if (perm[6] != '-') mode |= S_IXGRP; | ||
1178 | // other permissions | 1178 | // other permissions | ||
1179 | if (perm[7] != '-') mode |= S_IROTH; | 1179 | if (perm[7] != '-') mode |= S_IROTH; | ||
1180 | if (perm[8] != '-') mode |= S_IWOTH; | 1180 | if (perm[8] != '-') mode |= S_IWOTH; | ||
1181 | if (perm[9] != '-') mode |= S_IXOTH; | 1181 | if (perm[9] != '-') mode |= S_IXOTH; | ||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Line(s) | 1321 | if (arcType == "rpm") { | |||
1328 | // next field is md5sum, ignore it | 1328 | // next field is md5sum, ignore it | ||
1329 | nextWord(line); | 1329 | nextWord(line); | ||
1330 | // permissions | 1330 | // permissions | ||
1331 | mode = nextWord(line).toULong(nullptr, 8); | 1331 | mode = nextWord(line).toULong(nullptr, 8); | ||
1332 | // Owner & Group | 1332 | // Owner & Group | ||
1333 | owner = nextWord(line); | 1333 | owner = nextWord(line); | ||
1334 | group = nextWord(line); | 1334 | group = nextWord(line); | ||
1335 | // symlink destination | 1335 | // symlink destination | ||
1336 | #ifndef Q_WS_WIN | 1336 | #ifndef Q_OS_WIN | ||
1337 | if (S_ISLNK(mode)) { | 1337 | if (S_ISLNK(mode)) { | ||
1338 | // ignore the next 3 fields | 1338 | // ignore the next 3 fields | ||
1339 | nextWord(line); nextWord(line); nextWord(line); | 1339 | nextWord(line); nextWord(line); nextWord(line); | ||
1340 | symlinkDest = nextWord(line); | 1340 | symlinkDest = nextWord(line); | ||
1341 | } | 1341 | } | ||
1342 | #endif | 1342 | #endif | ||
1343 | } | 1343 | } | ||
1344 | if (arcType == "gzip") { | 1344 | if (arcType == "gzip") { | ||
▲ Show 20 Lines • Show All 345 Lines • ▼ Show 20 Line(s) | 1687 | if (!getPassword().isEmpty()) { | |||
1690 | copyCmd << QString("-p%1").arg(password); | 1690 | copyCmd << QString("-p%1").arg(password); | ||
1691 | if (!putCmd.isEmpty()) { | 1691 | if (!putCmd.isEmpty()) { | ||
1692 | putCmd << QString("-p%1").arg(password); | 1692 | putCmd << QString("-p%1").arg(password); | ||
1693 | delCmd << QString("-p%1").arg(password); | 1693 | delCmd << QString("-p%1").arg(password); | ||
1694 | } | 1694 | } | ||
1695 | } | 1695 | } | ||
1696 | } | 1696 | } | ||
1697 | // checking if it's an absolute path | 1697 | // checking if it's an absolute path | ||
1698 | #ifdef Q_WS_WIN | 1698 | #ifdef Q_OS_WIN | ||
1699 | if (cmd.length() > 2 && cmd[ 0 ].isLetter() && cmd[ 1 ] == ':') | 1699 | if (cmd.length() > 2 && cmd[ 0 ].isLetter() && cmd[ 1 ] == ':') | ||
1700 | return true; | 1700 | return true; | ||
1701 | #else | 1701 | #else | ||
1702 | if (cmd.startsWith(DIR_SEPARATOR)) | 1702 | if (cmd.startsWith(DIR_SEPARATOR)) | ||
1703 | return true; | 1703 | return true; | ||
1704 | #endif | 1704 | #endif | ||
1705 | if (QStandardPaths::findExecutable(cmd).isEmpty()) { | 1705 | if (QStandardPaths::findExecutable(cmd).isEmpty()) { | ||
1706 | error(KIO::ERR_CANNOT_LAUNCH_PROCESS, | 1706 | error(KIO::ERR_CANNOT_LAUNCH_PROCESS, | ||
▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Line(s) | |||||
1916 | } | 1916 | } | ||
1917 | 1917 | | |||
1918 | QString kio_krarcProtocol::getPath(const QUrl &url, QUrl::FormattingOptions options) | 1918 | QString kio_krarcProtocol::getPath(const QUrl &url, QUrl::FormattingOptions options) | ||
1919 | { | 1919 | { | ||
1920 | // Note: KRFUNC was not used here in order to avoid filling the log with too much information | 1920 | // Note: KRFUNC was not used here in order to avoid filling the log with too much information | ||
1921 | QString path = url.adjusted(options).path(); | 1921 | QString path = url.adjusted(options).path(); | ||
1922 | REPLACE_DIR_SEP2(path); | 1922 | REPLACE_DIR_SEP2(path); | ||
1923 | 1923 | | |||
1924 | #ifdef Q_WS_WIN | 1924 | #ifdef Q_OS_WIN | ||
1925 | if (path.startsWith(DIR_SEPARATOR)) { | 1925 | if (path.startsWith(DIR_SEPARATOR)) { | ||
1926 | int p = 1; | 1926 | int p = 1; | ||
1927 | while (p < path.length() && path[ p ] == DIR_SEPARATOR_CHAR) | 1927 | while (p < path.length() && path[ p ] == DIR_SEPARATOR_CHAR) | ||
1928 | p++; | 1928 | p++; | ||
1929 | /* /C:/Folder */ | 1929 | /* /C:/Folder */ | ||
1930 | if (p + 2 <= path.length() && path[ p ].isLetter() && path[ p + 1 ] == ':') { | 1930 | if (p + 2 <= path.length() && path[ p ].isLetter() && path[ p + 1 ] == ':') { | ||
1931 | path = path.mid(p); | 1931 | path = path.mid(p); | ||
1932 | } | 1932 | } | ||
1933 | } | 1933 | } | ||
1934 | #endif | 1934 | #endif | ||
1935 | return path; | 1935 | return path; | ||
1936 | } | 1936 | } | ||
1937 | 1937 | | |||
1938 | #endif // KRARC_ENABLED | 1938 | #endif // KRARC_ENABLED |