Merge branch 'release/20.12'
This commit is contained in:
commit
70d4819aae
|
@ -83,7 +83,7 @@ FstabEntryList readFstabEntries( const QString& fstabPath )
|
||||||
// (5) pass number (optional, defaults to 0), no comment is allowed if omitted,
|
// (5) pass number (optional, defaults to 0), no comment is allowed if omitted,
|
||||||
// (#) comment (optional).
|
// (#) comment (optional).
|
||||||
auto fsSpec = splitLine.at(0);
|
auto fsSpec = splitLine.at(0);
|
||||||
auto mountPoint = splitLine.at(1);
|
auto mountPoint = unescapeSpaces(splitLine.at(1));
|
||||||
auto fsType = splitLine.at(2);
|
auto fsType = splitLine.at(2);
|
||||||
auto options = splitLine.at(3);
|
auto options = splitLine.at(3);
|
||||||
|
|
||||||
|
@ -110,6 +110,22 @@ FstabEntryList readFstabEntries( const QString& fstabPath )
|
||||||
return fstabEntries;
|
return fstabEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString escapeSpaces(const QString& mountPoint)
|
||||||
|
{
|
||||||
|
QString tmp = mountPoint;
|
||||||
|
tmp.replace(QStringLiteral(" "), QStringLiteral("\\040"));
|
||||||
|
tmp.replace(QStringLiteral("\t"), QStringLiteral("\\011"));
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString unescapeSpaces(const QString& mountPoint)
|
||||||
|
{
|
||||||
|
QString tmp = mountPoint;
|
||||||
|
tmp.replace(QStringLiteral("\\040"), QStringLiteral(" "));
|
||||||
|
tmp.replace(QStringLiteral("\\011"), QStringLiteral("\t"));
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
void FstabEntry::setFsSpec(const QString& s)
|
void FstabEntry::setFsSpec(const QString& s)
|
||||||
{
|
{
|
||||||
d->m_fsSpec = s;
|
d->m_fsSpec = s;
|
||||||
|
@ -262,7 +278,7 @@ static void writeEntry(QTextStream& s, const FstabEntry& entry, std::array<unsig
|
||||||
s.setFieldAlignment(QTextStream::AlignLeft);
|
s.setFieldAlignment(QTextStream::AlignLeft);
|
||||||
s.setFieldWidth(columnWidth[0]);
|
s.setFieldWidth(columnWidth[0]);
|
||||||
s << entry.fsSpec()
|
s << entry.fsSpec()
|
||||||
<< qSetFieldWidth(columnWidth[1]) << (entry.mountPoint().isEmpty() ? QStringLiteral("none") : entry.mountPoint())
|
<< qSetFieldWidth(columnWidth[1]) << (entry.mountPoint().isEmpty() ? QStringLiteral("none") : escapeSpaces(entry.mountPoint()))
|
||||||
<< qSetFieldWidth(columnWidth[2]) << entry.type()
|
<< qSetFieldWidth(columnWidth[2]) << entry.type()
|
||||||
<< qSetFieldWidth(columnWidth[3]) << entry.optionsString() << qSetFieldWidth(0)
|
<< qSetFieldWidth(columnWidth[3]) << entry.optionsString() << qSetFieldWidth(0)
|
||||||
<< entry.dumpFreq() << " "
|
<< entry.dumpFreq() << " "
|
||||||
|
|
|
@ -111,6 +111,9 @@ private:
|
||||||
|
|
||||||
typedef QList<FstabEntry> FstabEntryList;
|
typedef QList<FstabEntry> FstabEntryList;
|
||||||
|
|
||||||
|
QString escapeSpaces(const QString& mountPoint);
|
||||||
|
QString unescapeSpaces(const QString& mountPoint);
|
||||||
|
|
||||||
LIBKPMCORE_EXPORT FstabEntryList readFstabEntries(const QString& fstabPath = QStringLiteral("/etc/fstab"));
|
LIBKPMCORE_EXPORT FstabEntryList readFstabEntries(const QString& fstabPath = QStringLiteral("/etc/fstab"));
|
||||||
LIBKPMCORE_EXPORT QStringList possibleMountPoints(const QString& deviceNode, const QString& fstabPath = QStringLiteral("/etc/fstab"));
|
LIBKPMCORE_EXPORT QStringList possibleMountPoints(const QString& deviceNode, const QString& fstabPath = QStringLiteral("/etc/fstab"));
|
||||||
LIBKPMCORE_EXPORT bool writeMountpoints(const FstabEntryList& fstabEntries, const QString& filename = QStringLiteral("/etc/fstab"));
|
LIBKPMCORE_EXPORT bool writeMountpoints(const FstabEntryList& fstabEntries, const QString& filename = QStringLiteral("/etc/fstab"));
|
||||||
|
|
Loading…
Reference in New Issue