, <porten@kde.org>
From: None <hubert@feyrer.de>
List: tech-pkg
Date: 11/18/2000 03:03:57
Greg, the patch (the second chunk, to be precise) below fixes the problem
that mkdir() is called with a trailing slash. The first patch is from you.
Please put in your collection of patches against KDE2.0 ;-)
Harri, do you think you can commit this to the KDE repository?
NetBSD (and maybe other Unices) doesn't allow mkdir(2) to be called
with a trailing "/" on the pathname. Thanks!
With this patch, KDE2 is a whole lot more usable on NetBSD. 8-)
- Hubert
$NetBSD$
--- kstddirs.cpp.orig Thu Sep 21 20:01:04 2000
+++ kstddirs.cpp
@@ -586,33 +586,33 @@
QString KStandardDirs::kde_default(const char *type) {
if (!strcmp(type, "data"))
- return "share/apps/";
+ return "share/kde/apps/";
if (!strcmp(type, "html"))
- return "share/doc/HTML/";
+ return "share/doc/kde/HTML/";
if (!strcmp(type, "icon"))
- return "share/icons/";
+ return "share/kde/icons/";
if (!strcmp(type, "config"))
- return "share/config/";
+ return "share/kde/config/";
if (!strcmp(type, "pixmap"))
- return "share/pixmaps/";
+ return "share/kde/pixmaps/";
if (!strcmp(type, "apps"))
- return "share/applnk/";
+ return "share/kde/applnk/";
if (!strcmp(type, "sound"))
- return "share/sounds/";
+ return "share/kde/sounds/";
if (!strcmp(type, "locale"))
- return "share/locale/";
+ return "share/kde/locale/";
if (!strcmp(type, "services"))
- return "share/services/";
+ return "share/kde/services/";
if (!strcmp(type, "servicetypes"))
- return "share/servicetypes/";
+ return "share/kde/servicetypes/";
if (!strcmp(type, "mime"))
- return "share/mimelnk/";
+ return "share/kde/mimelnk/";
if (!strcmp(type, "cgi"))
- return "cgi-bin/";
+ return "kde-cgi-bin/";
if (!strcmp(type, "wallpaper"))
- return "share/wallpapers/";
+ return "share/kde/wallpapers/";
if (!strcmp(type, "templates"))
- return "share/templates/";
+ return "share/kde/templates/";
if (!strcmp(type, "exe"))
return "bin/";
if (!strcmp(type, "lib"))
@@ -663,18 +663,32 @@
QString target = dir;
uint len = target.length();
+#ifdef __NetBSD__
+ // HF: I have no idea why they insist on tacking a trailing '/' on
+ // for mkdir, but at least on NetBSD, this blows up rather hard.
+#else
// append trailing slash if missing
if (dir.at(len - 1) != '/')
target += '/';
+#endif
+#ifdef __NetBSD__
+ QString base(""); // HF: we tack on leading '/'s
+#else
QString base("/");
+#endif
uint i = 1;
while( i < len )
{
struct stat st;
int pos = target.find('/', i);
- base += target.mid(i, pos - i + 1);
+#ifdef __NetBSD__
+ base += target.mid(i - 1, pos - i ); /* no trailing '/'! */
+#else
+ base += target.mid(i, pos - i + 1);
+#endif
+
// bail out if we encountered a problem
if (stat(QFile::encodeName(base), &st) != 0)
{
--
Hubert Feyrer <hubert@feyrer.de>