From d3a9d56143cf668c7d29b26a324a424d02036371 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 15 May 2012 14:10:16 -0500 Subject: Add the ability to force read-only configuration file access in a TDE application Force tde-config to use read-only access This closes Bug 293 --- tdecore/kconfigbase.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tdecore/kconfigbase.cpp') diff --git a/tdecore/kconfigbase.cpp b/tdecore/kconfigbase.cpp index 9ad660037..c5c0a4e25 100644 --- a/tdecore/kconfigbase.cpp +++ b/tdecore/kconfigbase.cpp @@ -1139,16 +1139,18 @@ static TQString translatePath( TQString path ) // return original path, if it refers to another type of URL (e.g. http:/), or // if the path is already relative to another directory - if (!startsWithFile && path[0] != '/' || - startsWithFile && path[5] != '/') + if (((!startsWithFile) && (path[0] != '/')) || (startsWithFile && (path[5] != '/'))) { return path; + } - if (startsWithFile) + if (startsWithFile) { path.remove(0,5); // strip leading "file:/" off the string + } // keep only one single '/' at the beginning - needed for cleanHomeDirPath() - while (path[0] == '/' && path[1] == '/') + while (path[0] == '/' && path[1] == '/') { path.remove(0,1); + } // we can not use KGlobal::dirs()->relativeLocation("home", path) here, // since it would not recognize paths without a trailing '/'. -- cgit v1.2.1