|
|
@ -189,7 +189,7 @@ void KStandardDirs::addPrefix( const TQString& _dir, bool priority )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
TQString dir = _dir;
|
|
|
|
TQString dir = _dir;
|
|
|
|
if (dir.at(dir.length() - 1) != (QChar)'/')
|
|
|
|
if (dir.at(dir.length() - 1) != '/')
|
|
|
|
dir += '/';
|
|
|
|
dir += '/';
|
|
|
|
|
|
|
|
|
|
|
|
if (!prefixes.contains(dir)) {
|
|
|
|
if (!prefixes.contains(dir)) {
|
|
|
@ -209,7 +209,7 @@ void KStandardDirs::addXdgConfigPrefix( const TQString& _dir, bool priority )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
TQString dir = _dir;
|
|
|
|
TQString dir = _dir;
|
|
|
|
if (dir.at(dir.length() - 1) != (QChar)'/')
|
|
|
|
if (dir.at(dir.length() - 1) != '/')
|
|
|
|
dir += '/';
|
|
|
|
dir += '/';
|
|
|
|
|
|
|
|
|
|
|
|
if (!d->xdgconf_prefixes.contains(dir)) {
|
|
|
|
if (!d->xdgconf_prefixes.contains(dir)) {
|
|
|
@ -229,7 +229,7 @@ void KStandardDirs::addXdgDataPrefix( const TQString& _dir, bool priority )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
TQString dir = _dir;
|
|
|
|
TQString dir = _dir;
|
|
|
|
if (dir.at(dir.length() - 1) != (QChar)'/')
|
|
|
|
if (dir.at(dir.length() - 1) != '/')
|
|
|
|
dir += '/';
|
|
|
|
dir += '/';
|
|
|
|
|
|
|
|
|
|
|
|
if (!d->xdgdata_prefixes.contains(dir)) {
|
|
|
|
if (!d->xdgdata_prefixes.contains(dir)) {
|
|
|
@ -271,7 +271,7 @@ bool KStandardDirs::addResourceType( const char *type,
|
|
|
|
relatives.insert(type, rels);
|
|
|
|
relatives.insert(type, rels);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TQString copy = relativename;
|
|
|
|
TQString copy = relativename;
|
|
|
|
if (copy.at(copy.length() - 1) != (QChar)'/')
|
|
|
|
if (copy.at(copy.length() - 1) != '/')
|
|
|
|
copy += '/';
|
|
|
|
copy += '/';
|
|
|
|
if (!rels->contains(copy)) {
|
|
|
|
if (!rels->contains(copy)) {
|
|
|
|
if (priority)
|
|
|
|
if (priority)
|
|
|
@ -301,7 +301,7 @@ bool KStandardDirs::addResourceDir( const char *type,
|
|
|
|
absolutes.insert(type, paths);
|
|
|
|
absolutes.insert(type, paths);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TQString copy = absdir;
|
|
|
|
TQString copy = absdir;
|
|
|
|
if (copy.at(copy.length() - 1) != (QChar)'/')
|
|
|
|
if (copy.at(copy.length() - 1) != '/')
|
|
|
|
copy += '/';
|
|
|
|
copy += '/';
|
|
|
|
|
|
|
|
|
|
|
|
if (!paths->contains(copy)) {
|
|
|
|
if (!paths->contains(copy)) {
|
|
|
@ -452,7 +452,7 @@ bool KStandardDirs::exists(const TQString &fullPath)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KDE_struct_stat buff;
|
|
|
|
KDE_struct_stat buff;
|
|
|
|
if (access(TQFile::encodeName(fullPath), R_OK) == 0 && KDE_stat( TQFile::encodeName(fullPath), &buff ) == 0)
|
|
|
|
if (access(TQFile::encodeName(fullPath), R_OK) == 0 && KDE_stat( TQFile::encodeName(fullPath), &buff ) == 0)
|
|
|
|
if (fullPath.at(fullPath.length() - 1) != (QChar)'/') {
|
|
|
|
if (fullPath.at(fullPath.length() - 1) != '/') {
|
|
|
|
if (S_ISREG( buff.st_mode ))
|
|
|
|
if (S_ISREG( buff.st_mode ))
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else
|
|
|
|
} else
|
|
|
@ -478,9 +478,9 @@ static void lookupDirectory(const TQString& path, const TQString &relPart,
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Q_WS_WIN
|
|
|
|
#ifdef Q_WS_WIN
|
|
|
|
assert(path.at(path.length() - 1) == (QChar)'/' || path.at(path.length() - 1) == (QChar)'\\');
|
|
|
|
assert(path.at(path.length() - 1) == '/' || path.at(path.length() - 1) == '\\');
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
assert(path.at(path.length() - 1) == (QChar)'/');
|
|
|
|
assert(path.at(path.length() - 1) == '/');
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
struct dirent *ep;
|
|
|
|
struct dirent *ep;
|
|
|
@ -492,7 +492,7 @@ static void lookupDirectory(const TQString& path, const TQString &relPart,
|
|
|
|
while( ( ep = readdir( dp ) ) != 0L )
|
|
|
|
while( ( ep = readdir( dp ) ) != 0L )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString fn( TQFile::decodeName(ep->d_name));
|
|
|
|
TQString fn( TQFile::decodeName(ep->d_name));
|
|
|
|
if (fn == _dot || fn == _dotdot || (TQCString)(fn.at(fn.length() - 1).latin1()) == '~')
|
|
|
|
if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~')
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (!recursive && !regexp.exactMatch(fn))
|
|
|
|
if (!recursive && !regexp.exactMatch(fn))
|
|
|
@ -569,9 +569,9 @@ static void lookupPrefix(const TQString& prefix, const TQString& relpath,
|
|
|
|
if (prefix.isEmpty()) //for sanity
|
|
|
|
if (prefix.isEmpty()) //for sanity
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
#ifdef Q_WS_WIN
|
|
|
|
#ifdef Q_WS_WIN
|
|
|
|
assert(prefix.at(prefix.length() - 1) == (QChar)'/' || prefix.at(prefix.length() - 1) == (QChar)'\\');
|
|
|
|
assert(prefix.at(prefix.length() - 1) == '/' || prefix.at(prefix.length() - 1) == '\\');
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
assert(prefix.at(prefix.length() - 1) == (QChar)'/');
|
|
|
|
assert(prefix.at(prefix.length() - 1) == '/');
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
KDE_struct_stat buff;
|
|
|
|
KDE_struct_stat buff;
|
|
|
|
|
|
|
|
|
|
|
@ -591,7 +591,7 @@ static void lookupPrefix(const TQString& prefix, const TQString& relpath,
|
|
|
|
while( ( ep = readdir( dp ) ) != 0L )
|
|
|
|
while( ( ep = readdir( dp ) ) != 0L )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString fn( TQFile::decodeName(ep->d_name));
|
|
|
|
TQString fn( TQFile::decodeName(ep->d_name));
|
|
|
|
if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1) == (QChar)'~')
|
|
|
|
if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1) == '~')
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !pathExp.exactMatch(fn) )
|
|
|
|
if ( !pathExp.exactMatch(fn) )
|
|
|
@ -692,7 +692,7 @@ KStandardDirs::realPath(const TQString &dirname)
|
|
|
|
if (realpath( TQFile::encodeName(dirname).data(), realpath_buffer) != 0) {
|
|
|
|
if (realpath( TQFile::encodeName(dirname).data(), realpath_buffer) != 0) {
|
|
|
|
// success, use result from realpath
|
|
|
|
// success, use result from realpath
|
|
|
|
int len = strlen(realpath_buffer);
|
|
|
|
int len = strlen(realpath_buffer);
|
|
|
|
realpath_buffer[len] = (QChar)'/';
|
|
|
|
realpath_buffer[len] = '/';
|
|
|
|
realpath_buffer[len+1] = 0;
|
|
|
|
realpath_buffer[len+1] = 0;
|
|
|
|
return TQFile::decodeName(realpath_buffer);
|
|
|
|
return TQFile::decodeName(realpath_buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -771,7 +771,7 @@ void KStandardDirs::createSpecialResource(const char *type)
|
|
|
|
if (result > 0)
|
|
|
|
if (result > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
link[result] = 0;
|
|
|
|
link[result] = 0;
|
|
|
|
if (link[0] == (int)'/')
|
|
|
|
if (link[0] == '/')
|
|
|
|
dir = TQFile::decodeName(link);
|
|
|
|
dir = TQFile::decodeName(link);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
dir = TQDir::cleanDirPath(dir+TQFile::decodeName(link));
|
|
|
|
dir = TQDir::cleanDirPath(dir+TQFile::decodeName(link));
|
|
|
@ -892,7 +892,7 @@ TQStringList KStandardDirs::systemPaths( const TQString& pstr )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
p = tokens[ i ];
|
|
|
|
p = tokens[ i ];
|
|
|
|
|
|
|
|
|
|
|
|
if ( p[ 0 ] == (QChar)'~' )
|
|
|
|
if ( p[ 0 ] == '~' )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int len = p.find( '/' );
|
|
|
|
int len = p.find( '/' );
|
|
|
|
if ( len == -1 )
|
|
|
|
if ( len == -1 )
|
|
|
@ -1167,7 +1167,7 @@ bool KStandardDirs::makeDir(const TQString& dir, int mode)
|
|
|
|
uint len = target.length();
|
|
|
|
uint len = target.length();
|
|
|
|
|
|
|
|
|
|
|
|
// append trailing slash if missing
|
|
|
|
// append trailing slash if missing
|
|
|
|
if (dir.at(len - 1) != (QChar)'/')
|
|
|
|
if (dir.at(len - 1) != '/')
|
|
|
|
target += '/';
|
|
|
|
target += '/';
|
|
|
|
|
|
|
|
|
|
|
|
TQString base("");
|
|
|
|
TQString base("");
|
|
|
@ -1220,7 +1220,7 @@ static TQString executablePrefix()
|
|
|
|
if (length == -1)
|
|
|
|
if (length == -1)
|
|
|
|
return TQString::null;
|
|
|
|
return TQString::null;
|
|
|
|
|
|
|
|
|
|
|
|
path_buffer[length] = (QChar)'\0';
|
|
|
|
path_buffer[length] = '\0';
|
|
|
|
|
|
|
|
|
|
|
|
TQString path = TQFile::decodeName(path_buffer);
|
|
|
|
TQString path = TQFile::decodeName(path_buffer);
|
|
|
|
|
|
|
|
|
|
|
@ -1314,7 +1314,7 @@ void KStandardDirs::addKDEDefaults()
|
|
|
|
TQString localKdeDir = readEnvPath(getuid() ? "KDEHOME" : "KDEROOTHOME");
|
|
|
|
TQString localKdeDir = readEnvPath(getuid() ? "KDEHOME" : "KDEROOTHOME");
|
|
|
|
if (!localKdeDir.isEmpty())
|
|
|
|
if (!localKdeDir.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (localKdeDir[localKdeDir.length()-1] != (QChar)'/')
|
|
|
|
if (localKdeDir[localKdeDir.length()-1] != '/')
|
|
|
|
localKdeDir += '/';
|
|
|
|
localKdeDir += '/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -1358,7 +1358,7 @@ void KStandardDirs::addKDEDefaults()
|
|
|
|
TQString localXdgDir = readEnvPath("XDG_CONFIG_HOME");
|
|
|
|
TQString localXdgDir = readEnvPath("XDG_CONFIG_HOME");
|
|
|
|
if (!localXdgDir.isEmpty())
|
|
|
|
if (!localXdgDir.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (localXdgDir[localXdgDir.length()-1] != (QChar)'/')
|
|
|
|
if (localXdgDir[localXdgDir.length()-1] != '/')
|
|
|
|
localXdgDir += '/';
|
|
|
|
localXdgDir += '/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -1390,7 +1390,7 @@ void KStandardDirs::addKDEDefaults()
|
|
|
|
it != kdedirList.end(); ++it)
|
|
|
|
it != kdedirList.end(); ++it)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString dir = *it;
|
|
|
|
TQString dir = *it;
|
|
|
|
if (dir[dir.length()-1] != (QChar)'/')
|
|
|
|
if (dir[dir.length()-1] != '/')
|
|
|
|
dir += '/';
|
|
|
|
dir += '/';
|
|
|
|
xdgdirList.append(dir+"share/");
|
|
|
|
xdgdirList.append(dir+"share/");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1402,7 +1402,7 @@ void KStandardDirs::addKDEDefaults()
|
|
|
|
localXdgDir = readEnvPath("XDG_DATA_HOME");
|
|
|
|
localXdgDir = readEnvPath("XDG_DATA_HOME");
|
|
|
|
if (!localXdgDir.isEmpty())
|
|
|
|
if (!localXdgDir.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (localXdgDir[localXdgDir.length()-1] != (QChar)'/')
|
|
|
|
if (localXdgDir[localXdgDir.length()-1] != '/')
|
|
|
|
localXdgDir += '/';
|
|
|
|
localXdgDir += '/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|