Skip to content

Commit

Permalink
Win-specific: Use "%APPDATA%" instead of "Application Data" for home …
Browse files Browse the repository at this point in the history
…folder
  • Loading branch information
Abs62 committed Oct 28, 2011
1 parent 8c05658 commit 9825750
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions config.cc
Expand Up @@ -28,15 +28,15 @@ namespace
if ( isPortableVersion() )
return QDir( QCoreApplication::applicationDirPath() + "/portable" );

QDir result = QDir::home();

char const * pathInHome =
#ifdef Q_OS_WIN32
"Application Data/GoldenDict"
#else
".goldendict"
#endif
;
QDir result;

#ifdef Q_OS_WIN32
char const * pathInHome = "GoldenDict";
result = QDir::fromNativeSeparators( QString::fromWCharArray( _wgetenv( L"APPDATA" ) ) );
#else
char const * pathInHome = ".goldendict";
result = QDir::home();
#endif

result.mkpath( pathInHome );

Expand Down

4 comments on commit 9825750

@dragonroot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about existing users who already have configuration in "Application Data/GoldenDict"? What would happen to them once they upgrade?

@Abs62
Copy link
Member Author

@Abs62 Abs62 commented on 9825750 Oct 29, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases (by default) it will be same folder. In Windows XP %APPDATA% leads to "Application Data" as is. In Vista/7 %APPDATA% leads to "AppData\Roaming", but "Application Data" points to same folder as junction point.
If user has change this value manually, he also know as to transfers settings to new folder because he has made it with other programs data.

@dragonroot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if a user did change this value manually, and then used older GD version for a year or so, and then upgrades to a newer version - does he suddenly lose all his configuration? His previous GD version used the hardcoded path, which then changed when he upgraded. This is just wrong. Please add a step which checks for presence of 'Application Data/GoldenDict' and uses that path if it exists. This way the user could switch to newer version and then even downgrade to the older one.

@Abs62
Copy link
Member Author

@Abs62 Abs62 commented on 9825750 Oct 30, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit 1d399aa

Please sign in to comment.