aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-shim/src/fs.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-22 23:40:47 +0900
committernsfisis <nsfisis@gmail.com>2026-06-22 23:40:47 +0900
commit99ef82a9807578c1e5749156a027949efaba75c4 (patch)
treee5f6bfb4c74c1ced20a9bc1c884f811f582e38eb /crates/shirabe-php-shim/src/fs.rs
parentffd3e239a56172d2a336fb4d6253c01f6b1a0100 (diff)
downloadphp-shirabe-99ef82a9807578c1e5749156a027949efaba75c4.tar.gz
php-shirabe-99ef82a9807578c1e5749156a027949efaba75c4.tar.zst
php-shirabe-99ef82a9807578c1e5749156a027949efaba75c4.zip
feat(json): resolve bundled Composer schema files via build.rs
JsonFile's schema paths previously relied on php_dir() (__DIR__), which has no runtime equivalent. Add a build.rs that copies composer-schema.json and composer-lock-schema.json next to the built executable, and resolve them with std::env::current_exe(). FilesystemRepository now embeds InstalledVersions.php directly via include_str! instead of reading it through php_dir(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim/src/fs.rs')
-rw-r--r--crates/shirabe-php-shim/src/fs.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/shirabe-php-shim/src/fs.rs b/crates/shirabe-php-shim/src/fs.rs
index a97433a..e55b689 100644
--- a/crates/shirabe-php-shim/src/fs.rs
+++ b/crates/shirabe-php-shim/src/fs.rs
@@ -512,8 +512,8 @@ pub fn file_put_contents3(_filename: &str, _data: &str, _flags: i64) -> Option<i
Some(_data.len() as i64)
}
-pub fn file_get_contents(_path: &str) -> Option<String> {
- std::fs::read(_path)
+pub fn file_get_contents(path: impl AsRef<std::path::Path>) -> Option<String> {
+ std::fs::read(path)
.ok()
.map(|bytes| String::from_utf8_lossy(&bytes).into_owned())
}