diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-20 08:33:49 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-20 08:33:57 +0900 |
| commit | f31b101ce1e921a026ba234b1f0a83b0392bc118 (patch) | |
| tree | b7ac2aa84d71ebd162cc21aeab0240e7e0544988 /crates/shirabe/src/util/platform.rs | |
| parent | 5e31fa33c3b5cf726a57a063b8e7a070869250fe (diff) | |
| download | php-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.tar.gz php-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.tar.zst php-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.zip | |
fix(compile): fix all remaining compile errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/platform.rs')
| -rw-r--r-- | crates/shirabe/src/util/platform.rs | 26 |
1 files changed, 24 insertions, 2 deletions
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<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() + } } |
