Avoid calling wxGetenv() twice unnecessarily

Use wxGetEnv() helper function which allows to write the code in more natural
and (slightly) more efficient way.

No real changes.
This commit is contained in:
Vadim Zeitlin
2017-03-09 18:02:14 +01:00
parent 41fe019f3b
commit 214aac6fd6

View File

@@ -268,13 +268,14 @@ wxString wxStandardPaths::GetUserDir(Dir userDir) const
// the version of wxWidgets used by the application.
wxLogNull logNull;
wxString homeDir = wxFileName::GetHomeDir();
const wxString homeDir = wxFileName::GetHomeDir();
if (userDir == Dir_Cache)
{
if (wxGetenv(wxT("XDG_CACHE_HOME")))
return wxGetenv(wxT("XDG_CACHE_HOME"));
else
return homeDir + wxT("/.cache");
wxString cacheDir;
if ( !wxGetEnv(wxS("XDG_CACHE_HOME"), &cacheDir) )
cacheDir = homeDir + wxS("/.cache");
return cacheDir;
}
wxString dirsFile = GetXDGConfigHome() + wxT("/user-dirs.dirs");