Index: libs/xdgbasedirs.cpp
===================================================================
--- libs/xdgbasedirs.cpp	(wersja 846037)
+++ libs/xdgbasedirs.cpp	(kopia robocza)
@@ -295,19 +295,22 @@
 
 QString XdgBaseDirsSingleton::homePath( const char *variable, const char *defaultSubDir )
 {
-  const QByteArray env = qgetenv( variable );
+  const QString env( QFile::decodeName( qgetenv( variable ) ) );
+#if defined(Q_OS_WIN) //krazy:exclude=cpp
+  const QByteArray appdata = qgetenv( "APPDATA" );
+  QString home( appdata.isEmpty() ? QDir::homePath() : QFile::decodeName( appdata ) );
+  home += QLatin1String( "/XDG" );
+#else
+  QString home( QDir::homePath() );
+#endif
 
   QString xdgPath;
   if ( env.isEmpty() ) {
-    xdgPath = QDir::homePath() + QLatin1Char( '/' ) + QLatin1String( defaultSubDir );
-#if defined(Q_OS_WIN) //krazy:exclude=cpp
-  } else if ( QDir::isAbsolutePath( QString::fromLocal8Bit( env ) ) ) {
-#else
-  } else if ( env.startsWith( '/' ) ) {
-#endif
-    xdgPath = QString::fromLocal8Bit( env );
+    xdgPath = home + QLatin1Char( '/' ) + QLatin1String( defaultSubDir );
+  } else if ( QDir::isAbsolutePath( env ) ) {
+    xdgPath = env;
   } else {
-    xdgPath = QDir::homePath() + QLatin1Char( '/' ) + QString::fromLocal8Bit( env );
+    xdgPath = home + QLatin1Char( '/' ) + env;
   }
 
   return xdgPath;
@@ -315,13 +318,13 @@
 
 QStringList XdgBaseDirsSingleton::systemPathList( const char *variable, const char *defaultDirList )
 {
-  const QByteArray env = qgetenv( variable );
+  const QString env( QFile::decodeName( qgetenv( variable ) ) );
 
   QString xdgDirList;
   if ( env.isEmpty() ) {
     xdgDirList = QLatin1String( defaultDirList );
   } else {
-    xdgDirList = QString::fromLocal8Bit( env );
+    xdgDirList = env;
   }
 
 #if defined(Q_OS_WIN) //krazy:exclude=cpp
Index: libs/xdgbasedirs_p.h
===================================================================
--- libs/xdgbasedirs_p.h	(wersja 846037)
+++ libs/xdgbasedirs_p.h	(kopia robocza)
@@ -86,8 +86,14 @@
      @brief Returns the user specific directory for the given resource type
 
      Unless the user's environment has a specific path set as an override
-     this will be the default as defined in the freedesktop.org base-dir-spec
+     this will be the default as defined in the freedesktop.org base-dir-spec,
+     i.e. home directory on Unix.
 
+     On Windows, if "APPDATA" environment variable is set, it's value plus "/XDG"
+     is returned. Otherwise, home dir's path plus "/XDG" is returned. 
+     Adding "XDG" subdirectory allows to keep the home or APPDATA directory cleaner
+     because dot-names do not really denote hidden files/directories on Windows. 
+
      @note Caches the value of the first call
 
      @param resource a named resource type, e.g. "config"
