Always strip trailing separators from wxFileName::GetTempDir() under MSW.

In the unlikely but still possible case when neither TMP nor TEMP environment
variables are defined under Windows, we use the standard ::GetTempPath()
function which can return a path with trailing backslashes, e.g. if it takes
it from USERPROFILE environment variable. Ensure that these backslashes are
stripped in this case as well.

Closes https://github.com/wxWidgets/wxWidgets/pull/67
This commit is contained in:
Catalin
2015-08-09 00:17:14 +03:00
committed by Vadim Zeitlin
parent c5d6f9d103
commit 8e9c327221

View File

@@ -1249,7 +1249,8 @@ wxString wxFileName::GetTempDir()
dir = wxMacFindFolderNoSeparator(short(kOnSystemDisk), kTemporaryFolderType, kCreateFolder);
#endif // systems with native way
}
else // we got directory from an environment variable
if ( !dir.empty() )
{
// remove any trailing path separators, we don't want to ever return
// them from this function for consistency
@@ -1266,7 +1267,7 @@ wxString wxFileName::GetTempDir()
}
// fall back to hard coded value
if ( dir.empty() )
else
{
#ifdef __UNIX_LIKE__
dir = CheckIfDirExists("/tmp");