From 8e9c32722193e4ec1e91d21111181b0f08bacf01 Mon Sep 17 00:00:00 2001 From: Catalin Date: Sun, 9 Aug 2015 00:17:14 +0300 Subject: [PATCH] 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 --- src/common/filename.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 70f131f45b..718db943ce 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -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");