Skip to content

Fix #900: Store console history.txt in %APPDATA%\vkQuake on Windows#916

Open
adrian-andrzjewski wants to merge 1 commit into
Novum:masterfrom
adrian-andrzjewski:fix/900-history-txt-location
Open

Fix #900: Store console history.txt in %APPDATA%\vkQuake on Windows#916
adrian-andrzjewski wants to merge 1 commit into
Novum:masterfrom
adrian-andrzjewski:fix/900-history-txt-location

Conversation

@adrian-andrzjewski

Copy link
Copy Markdown
Contributor

Problem

On Windows, history.txt (console command history) is created in whatever directory the user launches vkQuake from, instead of a centralized location.

Root Cause

In sys_sdl_win.c, host_parms->userdir was set to host_parms->basedir (current working directory), causing user data files to be written to the launch directory.

Solution

Added proper user directory support on Windows, storing user data in %APPDATA%\vkQuake (matching the Unix pattern with ~/.vkquake).

Changes:

  • Added Sys_GetUserdir() and Sys_GetUserdirArgs() functions to sys_sdl_win.c
  • Support -userdir command line override (matching Unix behavior)
  • Default to %APPDATA%\vkQuake for user data storage
  • Enables existing userdir != basedir checks in common.c

Testing

  • Build: 0 warnings, 0 errors (MSVC x64 Release)
  • Unit tests: 8/8 passed
  • Verified APPDATA directory creation
  • Verified pointer comparison logic for userdir detection

Expected Behavior

  • history.txt stored in %APPDATA%\vkQuake\
  • Console history persists across sessions regardless of launch directory
  • No file pollution in game/working directories
  • -userdir override available for custom paths

On Windows, host_parms->userdir was set to host_parms->basedir (the
current working directory), causing history.txt to be created in
whatever directory the user launched vkQuake from.

This fix adds proper user directory support on Windows, storing user
data in %APPDATA%\vkQuake (matching the Unix pattern with ~/.vkquake).

Changes:
- Add Sys_GetUserdir() and Sys_GetUserdirArgs() to sys_sdl_win.c
- Support -userdir command line override (matching Unix behavior)
- Default to %APPDATA%\vkQuake for user data storage
- This enables the existing userdir != basedir checks in common.c
@vsonnier

vsonnier commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Nevermind my previous (delete) coment, I'll redo it later differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants