portal2 icon indicating copy to clipboard operation
portal2 copied to clipboard

"Can't create LogFile" error when attempting to compile maps outside the Portal 2 directory since a recent update

Open vrad-exe opened this issue 2 years ago • 1 comments

Since a recent Portal 2 update, attempting to compile a map located anywhere outside of the Portal 2 directory will fail almost immediately producing an output similar to the following:

CDynamicFunction: Loading library 'Kernel32.dll' (76A90000)
CDynamicFunction: Lookup of 'TryEnterCriticalSection' in 'Kernel32.dll': 77900A20
Valve Software - vbsp.exe (Apr 18 2023)
20 threads
Can't create LogFile:"d:\games\steamlibrary\steamapps\common\console_map.log"

This is a major problem for modders who often need to store maps in a Git repository, cloud storage platform, or other location which cannot be easily relocated inside the Portal 2 directory.

The problem appears to be in the filesystem code, as replacing filesystem_stdio.dll with an old version allows the maps to compile again. My guess would be that one of the recent security patches implemented a check to prevent the game from writing files outside the intended locations as a safeguard for exploits, but whoever did that forgot that the map compilers are supposed to be able to write files anywhere. You'd probably need to implement the ability for this check to be bypassed in specific contexts. Perhaps this would be with a function in the filesystem interface to enable/disable the protection - command line tools like the map compilers would call this immediately on launch or before the specific points where they write files, while the game wouldn't.

This is potentially related to #403 as that issue can also be worked around by reverting the filesystem binary to an old version.

vrad-exe avatar Mar 24 '24 00:03 vrad-exe

so this is why portal 2 won't compile my map, thanks!

KingMonkeyBug avatar Nov 06 '25 23:11 KingMonkeyBug