Summary: | space in mountpoint don't work | ||
---|---|---|---|
Product: | [Applications] kdf | Reporter: | nils-eric |
Component: | general | Assignee: | Michael Kropfberger <michael.kropfberger> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 0.5 | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
nils-eric
2002-07-21 10:41:00 UTC
Subject: kdeutils/kdf CVS commit by staikos: Lazy fix for #45554 expandEscapes() expands \\ to \ and \0nn to octal(nn). If anyone cares, they can enhance this as they like. CCMAIL: 45554-done@bugs.kde.org M +31 -3 disklist.cpp 1.28 --- kdeutils/kdf/disklist.cpp #1.27:1.28 @@ -154,4 +154,32 @@ void DiskList::loadSettings() } + +static QString expandEscapes(const QString& s) { +QString rc; + for (int i = 0; i < s.length(); i++) { + if (s[i] == '\\') { + i++; + switch(s[i]) { + case '\\': // slash \\ + rc += '\\'; + break; + case '0': // octal 0nn + rc += static_cast<char>(s.mid(i,3).toInt(0, 8)); + i += 2; + break; + default: + // give up and not process anything else because I'm too lazy + // to implement other escapes + rc += '\\'; + rc += s[i]; + break; + } + } else { + rc += s[i]; + } + } +return rc; +} + /*************************************************************************** * tries to figure out the possibly mounted fs @@ -177,5 +205,5 @@ QFile f(FSTAB); disk = new DiskEntry();// Q_CHECK_PTR(disk); disk->setMounted(FALSE); - disk->setDeviceName(s.left(s.find(BLANK)) ); + disk->setDeviceName(expandEscapes(s.left(s.find(BLANK)))); s=s.remove(0,s.find(BLANK)+1 ); // kdDebug() << " deviceName: [" << disk->deviceName() << "]" << endl; @@ -184,5 +212,5 @@ QFile f(FSTAB); s=s.remove(0,s.find(BLANK)+1 ); #endif - disk->setMountPoint(s.left(s.find(BLANK)) ); + disk->setMountPoint(expandEscapes(s.left(s.find(BLANK)))); s=s.remove(0,s.find(BLANK)+1 ); //kdDebug() << " MountPoint: [" << disk->mountPoint() << "]" << endl; |