Changeset View
Changeset View
Standalone View
Standalone View
krArc/krarc.cpp
Show First 20 Lines • Show All 1847 Lines • ▼ Show 20 Line(s) | 1847 | } else { | |||
---|---|---|---|---|---|
1848 | error(errCode, QString()); | 1848 | error(errCode, QString()); | ||
1849 | #endif | 1849 | #endif | ||
1850 | } | 1850 | } | ||
1851 | 1851 | | |||
1852 | KRDEBUG(password); | 1852 | KRDEBUG(password); | ||
1853 | return password; | 1853 | return password; | ||
1854 | } | 1854 | } | ||
1855 | 1855 | | |||
1856 | QString kio_krarcProtocol::detectFullPathName(QString name) | | |||
1857 | { | | |||
1858 | // Note: KRFUNC was not used here in order to avoid filling the log with too much information | | |||
1859 | KRDEBUG(name); | | |||
1860 | | ||||
1861 | name = name + EXEC_SUFFIX; | | |||
1862 | QStringList path = QString::fromLocal8Bit(qgetenv("PATH")).split(':'); | | |||
1863 | | ||||
1864 | for (auto & it : path) { | | |||
1865 | if (QDir(it).exists(name)) { | | |||
1866 | QString dir = it; | | |||
1867 | if (!dir.endsWith(DIR_SEPARATOR)) | | |||
1868 | dir += DIR_SEPARATOR; | | |||
1869 | | ||||
1870 | return dir + name; | | |||
1871 | } | | |||
1872 | } | | |||
1873 | return name; | | |||
1874 | } | | |||
1875 | | ||||
1876 | QString kio_krarcProtocol::fullPathName(const QString& name) | 1856 | QString kio_krarcProtocol::fullPathName(const QString& name) | ||
1877 | { | 1857 | { | ||
1878 | // Reminder: If that function is modified, it's important to research if the | 1858 | // Reminder: If that function is modified, it's important to research if the | ||
1879 | // changes must also be applied to `KrServices::fullPathName()` | 1859 | // changes must also be applied to `KrServices::fullPathName()` | ||
1880 | // and `KrServices::cmdExist()` | 1860 | // and `KrServices::cmdExist()` | ||
1881 | 1861 | | |||
1882 | // Note: KRFUNC was not used here in order to avoid filling the log with too much information | 1862 | // Note: KRFUNC was not used here in order to avoid filling the log with too much information | ||
1883 | KRDEBUG(name); | 1863 | KRDEBUG(name); | ||
1884 | 1864 | | |||
1885 | QString supposedName = confGrp.readEntry(name, QString()); | 1865 | QString supposedName = confGrp.readEntry(name, QString()); | ||
1886 | if (supposedName.isEmpty()) | 1866 | if (QFileInfo::exists(supposedName)) | ||
1887 | supposedName = detectFullPathName(name); | 1867 | return supposedName; | ||
1868 | | ||||
1869 | if ((supposedName = QStandardPaths::findExecutable(name)).isEmpty()) | ||||
1870 | return QString(); | ||||
1871 | | ||||
1872 | // Because an executable file has been found, its path is remembered | ||||
1873 | // in order to avoid some future searches | ||||
1874 | confGrp.writeEntry(name, supposedName); | ||||
1875 | | ||||
1888 | return supposedName; | 1876 | return supposedName; | ||
1889 | } | 1877 | } | ||
1890 | 1878 | | |||
1891 | QString kio_krarcProtocol::localeEncodedString(QString str) | 1879 | QString kio_krarcProtocol::localeEncodedString(QString str) | ||
1892 | { | 1880 | { | ||
1893 | // Note: KRFUNC was not used here in order to avoid filling the log with too much information | 1881 | // Note: KRFUNC was not used here in order to avoid filling the log with too much information | ||
1894 | if (noencoding) | 1882 | if (noencoding) | ||
1895 | return str; | 1883 | return str; | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |