summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-05-18 13:37:09 +0200
committerSlávek Banko <slavek.banko@axis.cz>2021-02-03 21:53:38 +0100
commitf659403a3aa81bf3a57a32dd7d32a3341d976cc4 (patch)
tree6f2c2980c358877a529a94fffff5fbcaf64c4060
parentb34eba61471c1138f1be8770163c8d25b5c66946 (diff)
downloadtdelibs-f659403a3aa81bf3a57a32dd7d32a3341d976cc4.tar.gz
tdelibs-f659403a3aa81bf3a57a32dd7d32a3341d976cc4.zip
Check existing XDG folders before localization of the name.
Some standard XDG folders may exist before the information is stored in ~/.config/user-dirs.dirs. Checking existing folders will prevent the creation of localized folders in addition to existing English ones. Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit dc699b4fd407fe4e4f887b8f2b3f44a096c9f761)
-rw-r--r--kdecore/kglobalsettings.cpp64
1 files changed, 48 insertions, 16 deletions
diff --git a/kdecore/kglobalsettings.cpp b/kdecore/kglobalsettings.cpp
index 6240a6e56..8db5b5361 100644
--- a/kdecore/kglobalsettings.cpp
+++ b/kdecore/kglobalsettings.cpp
@@ -141,36 +141,68 @@ static void readXdgUserDirs(TQString *desktop, TQString *documents, TQString *do
// Use sane values in case some paths are missing
if (desktop->isEmpty())
{
- *desktop = TQDir::homeDirPath() + "/" + i18n("Desktop") + "/";
- }
+ *desktop = TQDir::homeDirPath() + "/" + "Desktop" + "/";
+ if (!TQDir(*desktop).exists())
+ {
+ *desktop = TQDir::homeDirPath() + "/" + i18n("Desktop") + "/";
+ }
+ }
if (documents->isEmpty())
{
- *documents = TQDir::homeDirPath() + "/" + i18n("Documents") + "/";
- }
+ *documents = TQDir::homeDirPath() + "/" + "Documents" + "/";
+ if (!TQDir(*documents).exists())
+ {
+ *documents = TQDir::homeDirPath() + "/" + i18n("Documents") + "/";
+ }
+ }
if (download->isEmpty())
{
- *download = TQDir::homeDirPath() + "/" + i18n("Downloads") + "/";
- }
+ *download = TQDir::homeDirPath() + "/" + "Downloads" + "/";
+ if (!TQDir(*download).exists())
+ {
+ *download = TQDir::homeDirPath() + "/" + i18n("Downloads") + "/";
+ }
+ }
if (music->isEmpty())
{
- *music = TQDir::homeDirPath() + "/" + i18n("Music") + "/";
- }
+ *music = TQDir::homeDirPath() + "/" + "Music" + "/";
+ if (!TQDir(*music).exists())
+ {
+ *music = TQDir::homeDirPath() + "/" + i18n("Music") + "/";
+ }
+ }
if (pictures->isEmpty())
{
- *pictures = TQDir::homeDirPath() + "/" + i18n("Pictures") + "/";
- }
+ *pictures = TQDir::homeDirPath() + "/" + "Pictures" + "/";
+ if (!TQDir(*pictures).exists())
+ {
+ *pictures = TQDir::homeDirPath() + "/" + i18n("Pictures") + "/";
+ }
+ }
if (publicShare->isEmpty())
{
- *publicShare = TQDir::homeDirPath() + "/" + i18n("Public") + "/";
- }
+ *publicShare = TQDir::homeDirPath() + "/" + "Public" + "/";
+ if (!TQDir(*publicShare).exists())
+ {
+ *publicShare = TQDir::homeDirPath() + "/" + i18n("Public") + "/";
+ }
+ }
if (templates->isEmpty())
{
- *templates = TQDir::homeDirPath() + "/" + i18n("Templates") + "/";
- }
+ *templates = TQDir::homeDirPath() + "/" + "Templates" + "/";
+ if (!TQDir(*templates).exists())
+ {
+ *templates = TQDir::homeDirPath() + "/" + i18n("Templates") + "/";
+ }
+ }
if (videos->isEmpty())
{
- *videos = TQDir::homeDirPath() + "/" + i18n("Videos") + "/";
- }
+ *videos = TQDir::homeDirPath() + "/" + "Videos" + "/";
+ if (!TQDir(*videos).exists())
+ {
+ *videos = TQDir::homeDirPath() + "/" + i18n("Videos") + "/";
+ }
+ }
}
static void checkAndCreateXdgFolder(const TQString &folder, const TQString &path, KConfig *config)