Skip to content

util: Move os_mkdirs into platform-mkdirs.c - #1445

Merged
zackees merged 1 commit into
obs-rust:masterfrom
swilk19:port/platform-mkdirs-move
Oct 19, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
swilk19:port/platform-mkdirs-move

Conversation

@swilk19

@swilk19 swilk19 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Refs #262 (slice 4, directories).

Behavior-neutral extraction, as the testing policy asks before a partial-file port: os_mkdirs and its static recursive_mkdir move verbatim from libobs/util/platform.c.h into libobs/util/platform-mkdirs.c.h. No Rust, no signature, header or behavior change.

  • Build: the new file joins the existing libobs.platform unity group and libobs-platform.pch.h.
  • Oracle: rust/obs-c-oracle/oracle/platform.c includes it too (os_mkdirs was already renamed oracle_os_mkdirs there), so the oracle still runs the real C.
  • Ifdef ratchet: the moved code has no host conditionals.

New characterization test test_platform_mkdirs (tests.d/ fragment, plus the Cargo C-test manifest). test_platform only uses os_mkdirs for setup, so this covers missing and partly existing parents, existing paths, \ and mixed separators, trailing and doubled slashes, a non-ASCII name, and a file at the path or in a parent. Two cases are characterized, not endorsed:

  • a file at the path reports MKDIR_EXISTS;
  • a/b/ with a missing creates both directories but reports MKDIR_EXISTS (the last os_mkdir of a/b/ finds a/b).

Local: Tier 2 (rust/tools/linux-validate/run.sh) has the new cases passing against both libobs and libobs-with-rust, and exported symbols C vs Rust are IDENTICAL (1766). ./lint: build-groups, ifdef ratchet, clang-format and gersemi pass. The only failure is test_appimage_vaapi_compat, which also fails on master in my WSL environment.

Windows/macOS: PR CI scopes this Linux-only (ci_scope: windows=False, macos=False). The stacked port PR touches rust/obs-util/src/platform/, so its CI runs Windows and macOS Tier 2, which builds plain libobs with this moved file under MSVC and runs test_platform_mkdirs. I'll keep this as a draft until that passes and link the run here. The Rust port (RED, then GREEN) is that follow-up PR.

🤖 Generated with Claude Code

Refs obs-rust#262 (slice 4, directories).

Behavior-neutral extraction before the Rust port: os_mkdirs and its static
recursive_mkdir move verbatim from libobs/util/platform.c.h into
libobs/util/platform-mkdirs.c.h, in the same libobs.platform unity group
and precompiled header. The oracle compiles both files. No host
conditionals move.

test_platform_mkdirs characterizes os_mkdirs, which test_platform only
uses for setup: missing and partly existing parents, existing paths, '\'
and mixed separators, trailing and doubled slashes, non-ASCII names and a
file at the path or in a parent. Two cases are characterized, not
endorsed: a file at the path reports MKDIR_EXISTS, and "a/b/" with "a"
missing creates both directories but reports MKDIR_EXISTS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@swilk19

swilk19 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Windows and macOS proof from the stacked port #1446, whose head (d1fb36e6a) contains this PR's head (345b7402d): run 39180655677 is all green, including

Marking ready.

@swilk19
swilk19 marked this pull request as ready for review October 19, 2026 00:36
@swilk19
swilk19 requested a review from zackees as a code owner October 19, 2026 00:36

@zackees zackees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review: LGTM. A verbatim move of os_mkdirs/recursive_mkdir into platform-mkdirs.c.h with its unity group and PCH entry, plus a characterization test (missing parents, an existing path, a file in the way) that pins today's C behavior before #1446.

@zackees
zackees added this pull request to the merge queue Oct 19, 2026
Merged via the queue into obs-rust:master with commit 9ca0435 Oct 19, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants