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:
@@ -1249,7 +1249,8 @@ wxString wxFileName::GetTempDir()
|
|||||||
dir = wxMacFindFolderNoSeparator(short(kOnSystemDisk), kTemporaryFolderType, kCreateFolder);
|
dir = wxMacFindFolderNoSeparator(short(kOnSystemDisk), kTemporaryFolderType, kCreateFolder);
|
||||||
#endif // systems with native way
|
#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
|
// remove any trailing path separators, we don't want to ever return
|
||||||
// them from this function for consistency
|
// them from this function for consistency
|
||||||
@@ -1266,7 +1267,7 @@ wxString wxFileName::GetTempDir()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fall back to hard coded value
|
// fall back to hard coded value
|
||||||
if ( dir.empty() )
|
else
|
||||||
{
|
{
|
||||||
#ifdef __UNIX_LIKE__
|
#ifdef __UNIX_LIKE__
|
||||||
dir = CheckIfDirExists("/tmp");
|
dir = CheckIfDirExists("/tmp");
|
||||||
|
Reference in New Issue
Block a user