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:
parent
c5d6f9d103
commit
8e9c327221
1 changed files with 3 additions and 2 deletions
|
|
@ -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");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue