From f31b101ce1e921a026ba234b1f0a83b0392bc118 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 20 May 2026 08:33:49 +0900 Subject: fix(compile): fix all remaining compile errors Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/shirabe/src/util/platform.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'crates/shirabe/src/util/platform.rs') diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs index 1f684d8..64b3ae7 100644 --- a/crates/shirabe/src/util/platform.rs +++ b/crates/shirabe/src/util/platform.rs @@ -401,11 +401,11 @@ impl Platform { // TODO(phase-b): PHP_OS_FAMILY constant comparison && true { - let process = ProcessExecutor::new(); + let mut process = ProcessExecutor::new(None); // TODO(phase-b): inner Result for catch(\Exception); use anyhow::Result> let mut output = String::new(); let result: Result<()> = (|| { - if process.execute(&["lsmod"], &mut output)? == 0 + if process.execute_args(&["lsmod".to_string()], &mut output, ()) == 0 && shirabe_php_shim::str_contains(&output, "vboxguest") { *cached = Some(true); @@ -431,4 +431,26 @@ impl Platform { "/dev/null".to_string() } + + /// PHP: PHP_OS — returns the OS PHP was built on. + pub fn php_os() -> &'static str { + // TODO(phase-b): map to actual OS name (e.g. "Darwin", "Linux", "WINNT"). + todo!() + } + + /// PHP: rename($from, $to) — wrap the std rename so callers can use Platform::rename. + pub fn rename(from: &str, to: &str) -> bool { + std::fs::rename(from, to).is_ok() + } + + /// PHP: mkdir($pathname, $mode, $recursive) + pub fn mkdir(pathname: &str, _mode: u32, recursive: bool) -> bool { + // TODO(phase-b): honor mode bits on Unix + let result = if recursive { + std::fs::create_dir_all(pathname) + } else { + std::fs::create_dir(pathname) + }; + result.is_ok() + } } -- cgit v1.3.1