mirror-ghostty/src
Mitchell Hashimoto c74f6d56d1
os: use GetTempPathW for allocTmpDir on Windows (#12469)
`allocTmpDir` previously read `%TMP%` via `getenvW` and returned `null`
if the variable wasn't set, requiring each caller to to deal with the
nullable. Unfortunately, there isn't a platform-neutral default value
that makes sense for those cases (i.e. `/tmp` is POSIX-y).

We now use `GetTempPathW` on Windows, which is the official way to get
this directory: `TMP` → `TEMP` → `USERPROFILE` → `GetWindowsDirectoryW`.

With a real system call behind it, the function no longer needs to be
nullable: the only remaining failure modes are OOM (propagated) and the
syscall itself failing or returning data we can't decode. In those later
cases, we use `C:\Windows\Temp` as a fallback, similar to how we use
`/tmp` in the POSIX case.

The Windows path always allocates so it still must be paired with
`freeTmpDir`, which matches the existing contract.

---

*AI Disclosure:* I verified the Windows path using Claude and Zig's
cross-compilation capabilities because I don't have a Windows
environment in which to test this. I do fully understand the code based
on my prior life as a Windows game developer though.
2026-04-25 20:49:54 -07:00
..
apprt gtk/SurfaceScrolledWindow: wrap root child with another Adw.Bin (#12426) 2026-04-25 09:22:59 -07:00
benchmark benchmark: isolate parser hot loop from code-layout shifts 2026-04-23 21:36:39 -07:00
build build: gate lib-vt xcframework on emit-xcframework with xcodebuild detection 2026-04-24 13:21:43 -07:00
cli address review: Discover.init takes a Library across all backends 2026-04-23 23:06:21 +09:00
config feat: add default GTK keybinds for move_tab 2026-04-25 13:53:37 -03:00
crash Zig 0.15: zig build test macOS 2025-10-03 07:10:43 -07:00
datastruct split_tree: wrap spatial goto around edges 2026-02-17 20:35:25 -08:00
extra cli: add +explain-config 2026-03-15 20:58:43 -04:00
font font: add Windows font discovery backend (#12386) 2026-04-23 10:45:50 -07:00
input decbkm: use if statements instead of named blocks 2026-04-12 15:40:55 -05:00
inspector terminal: make stream processing infallible 2026-03-13 13:56:14 -07:00
lib build: refactor checkGhosttyHEnum to use @hasDecl instead of nested inline for 2026-03-24 20:12:57 +01:00
os os: use GetTempPathW for allocTmpDir on Windows (#12469) 2026-04-25 20:49:54 -07:00
renderer libghostty: add placement pixel_size and grid_size, rename calculatedSize 2026-04-06 10:03:34 -07:00
shell-integration zsh: fix trailing '%' in PS1/PS2 combining with marks 2026-03-25 10:58:06 -04:00
simd pkg/highway: vendor and modify to remain all libc usage 2026-04-23 20:28:43 -07:00
stb Fix typos 2025-10-03 18:52:26 +02:00
synthetic benchmark: add AGENTS, improve UTF-8 synthetic data 2026-04-15 08:28:36 -07:00
terminal os: use GetTempPathW for allocTmpDir on Windows 2026-04-25 21:44:37 -04:00
terminfo terminfo: add support for SGR dim 2026-03-03 09:48:48 +01:00
termio address review: add unit tests for Windows execCommand paths 2026-04-23 23:08:58 +09:00
unicode Merge remote-tracking branch 'upstream/main' into grapheme-width-changes 2026-01-27 09:44:55 -05:00
App.zig config: use Config to check key binding instead of App 2026-04-24 18:26:56 +02:00
Command.zig Command: let CreateProcessW resolve the program via PATH 2026-04-23 14:40:13 +09:00
Surface.zig core: Acquire renderer state mutex before calling processLinks (#12463) 2026-04-25 13:21:38 -07:00
apprt.zig Remove unused imports 2025-11-27 13:37:53 -08:00
build_config.zig Remove unused imports 2025-11-27 13:37:53 -08:00
cli.zig cli: make the action parser (+foo) generic and reusable 2025-07-09 15:06:24 -07:00
config.zig config: move file formatter to dedicated file to prevent import bloat 2026-03-23 09:11:23 -07:00
fastmem.zig perf: replace `std.debug.assert` with inlined version 2025-11-17 12:13:56 -07:00
file_type.zig util: introduce helper for detecting file types 2025-06-25 16:27:23 -04:00
global.zig logging: document GHOSTTY_LOG and make it more flexible 2025-12-15 11:54:36 -08:00
helpgen.zig build: fix Windows build failures in helpgen and framegen 2026-03-24 08:07:31 +01:00
input.zig input: extract mouse encoding to a pure, testable file 2026-03-15 15:37:54 -07:00
lib_vt.zig libghostty: add _get_multi to all _get APIs 2026-04-11 12:51:36 -07:00
main.zig remove src/bench 2025-07-09 15:06:24 -07:00
main_bench.zig Remove unused imports 2025-11-27 13:37:53 -08:00
main_build_data.zig build: fix Windows build failures in helpgen and framegen 2026-03-24 08:07:31 +01:00
main_c.zig address review: collapse DllMain into a single struct 2026-04-23 02:17:04 +09:00
main_gen.zig Remove unused imports 2025-11-27 13:37:53 -08:00
main_ghostty.zig tripwire: a module for injecting failures to test errdefer 2026-01-21 09:39:02 -08:00
main_wasm.zig
math.zig
pty.c core: simplify pty.c macro usage 2026-03-20 10:37:42 -05:00
pty.zig core: address getProcessInfo feedback 2026-03-19 22:01:16 -05:00
quirks.zig quirks: remove type signature for inlineAssert 2025-12-08 13:19:16 +08:00
renderer.zig testing: use std.Build.TranslateC instead of @cImport 2026-02-27 10:13:03 -06:00
surface_mouse.zig terminal: consolidate mouse types into mouse.zig 2026-03-15 15:48:36 -07:00
termio.zig search thread needs to take an allocated needle 2025-11-26 08:50:04 -08:00
tripwire.zig tripwire: change backing store from ArrayHashMap to EnumMap 2026-01-21 15:30:49 -08:00