Subject: [boost] [filesystem] temp_directory_path() behavior on Windows
From: Beman Dawes (bdawes_at_[hidden])
Date: 2015-01-31 10:07:58
temp_directory_path() on Windows is currently implemented by calling
the Windows API GetTempPath() function.
Ticket https://svn.boost.org/trac/boost/ticket/5300 points out that
GetTempPath() does not work as expected for environmental variables
longer than roughly 130 characters. I've added a test to
Boost.Filesystem that verifies that
boost::filesystem::temp_directory() is affected.
The suggested fix is to use GetEnvironmentVariable to in effect
implement GetTempPath() the way we would like it to work.
That makes sense to me, so I looked up the specs for GetTempPath():
The GetTempPath function checks for the existence of environment
variables in the following order and uses the first path found:
1. The path specified by the TMP environment variable.
2. The path specified by the TEMP environment variable.
3. The path specified by the USERPROFILE environment variable.
4. The Windows directory.
(4) Makes me queasy. I suspect it will fail anyhow because of
permissions errors, but I would prefer to have temp_directory_path()
report an error if 1, 2, and 3 are not present. temp_directory_path()
already reports an error if a path is found but it is not a directory.
OTOH, excluding the Windows directory is a breaking change for anyone
currently depending on that behavior, so I thought it best to ask for
comments before charging ahead.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk