diff --git a/README.md b/README.md
index d2cca3cc..61ecd056 100644
--- a/README.md
+++ b/README.md
@@ -190,7 +190,8 @@ the Wine prefix. Removing the option will revert to the previous behavior.
| Compat config string | Environment Variable | Description |
| :-------------------- | :----------------------------- | :----------- |
| | PROTON_LOG | Convenience method for dumping a useful debug log to `$HOME/steam-$APPID.log`. For more thorough logging, use `user_settings.py`. |
-| | PROTON_DUMP_DEBUG_COMMANDS | When running a game, Proton will write some useful debug scripts for that game into /tmp/proton_$USER/. |
+| | PROTON_DUMP_DEBUG_COMMANDS | When running a game, Proton will write some useful debug scripts for that game into `$PROTON_DEBUG_DIR/proton_$USER/`. |
+| | PROTON_DEBUG_DIR | Root directory for the Proton debug scripts, `/tmp` by default. |
| wined3d11 | PROTON_USE_WINED3D11 | Use OpenGL-based wined3d instead of Vulkan-based DXVK for d3d11. |
| nod3d11 | PROTON_NO_D3D11 | Disable d3d11.dll, for games which can fall back to and run better with d3d9. |
| noesync | PROTON_NO_ESYNC | Do not use eventfd-based in-process synchronization primitives. |
diff --git a/proton b/proton
index 683a76b9..e268b8af 100755
--- a/proton
+++ b/proton
@@ -388,7 +388,7 @@ def dump_dbg_env(f):
def dump_dbg_scripts():
exe_name = os.path.basename(sys.argv[2])
- dir = "/tmp/proton_" + os.environ["USER"] + "/"
+ dir = env.get("PROTON_DEBUG_DIR", "/tmp") + "/proton_" + os.environ["USER"] + "/"
makedirs(dir)
with open(dir + "winedbg", "w") as f:
@@ -469,7 +469,7 @@ def dump_dbg_scripts():
os.chmod(dir + "run", 0o755)
def run():
- if "PROTON_DUMP_DEBUG_COMMANDS" in os.environ:
+ if "PROTON_DUMP_DEBUG_COMMANDS" in env:
try:
dump_dbg_scripts()
except: