Closed SteffenL closed 11 years ago
Opening a file using the path returned by tmpnam() may result in a "permission denied" error on Windows. Now uses _tempnam() on Windows and tmpnam() on other platforms. Tested on Windows 8, using VC++ 2012 and Qt 4.8.1/MinGW 4.4.
Sample project: https://gist.github.com/SteffenL/5303896
Sample output when running build-all.bat:
==================== test-gcc ==================== TMP: C:\Users\Steffen\AppData\Local\Temp --- Test #1: tmpnam() --- Temp file path: \s7to. Permission denied --- Test #2: _tempnam() --- Temp file path: C:\Users\Steffen\AppData\Local\Temp\85 OK ==================== test-msvc ==================== TMP: C:\Users\Steffen\AppData\Local\Temp --- Test #1: tmpnam() --- Temp file path: \s3h4. OK --- Test #2: _tempnam() --- Temp file path: C:\Users\Steffen\AppData\Local\Temp\85 OK ==================== test-msvc-ide ==================== TMP: C:\Users\Steffen\AppData\Local\Temp --- Test #1: tmpnam() --- Temp file path: \s77g. Permission denied --- Test #2: _tempnam() --- Temp file path: C:\Users\Steffen\AppData\Local\Temp\85 OK
Opening a file using the path returned by tmpnam() may result in a "permission denied" error on Windows. Now uses _tempnam() on Windows and tmpnam() on other platforms. Tested on Windows 8, using VC++ 2012 and Qt 4.8.1/MinGW 4.4.
Sample project: https://gist.github.com/SteffenL/5303896
Sample output when running build-all.bat: