aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/filesystem_repository.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-19 00:10:22 +0900
committernsfisis <nsfisis@gmail.com>2026-05-19 00:11:03 +0900
commitc839244d8d09f3036ebfee8eef7eb6b147e593ab (patch)
treefe48c94f2c2e62468beef5ff1a8f3cff6adeef4f /crates/shirabe/src/repository/filesystem_repository.rs
parent48839250146b217e2756ed3c0e624fd341b54d6c (diff)
downloadphp-shirabe-c839244d8d09f3036ebfee8eef7eb6b147e593ab.tar.gz
php-shirabe-c839244d8d09f3036ebfee8eef7eb6b147e593ab.tar.zst
php-shirabe-c839244d8d09f3036ebfee8eef7eb6b147e593ab.zip
fix(compile): fix various compile errors
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/filesystem_repository.rs')
-rw-r--r--crates/shirabe/src/repository/filesystem_repository.rs29
1 files changed, 18 insertions, 11 deletions
diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs
index 0acc3b6..3d785e7 100644
--- a/crates/shirabe/src/repository/filesystem_repository.rs
+++ b/crates/shirabe/src/repository/filesystem_repository.rs
@@ -7,10 +7,10 @@ use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::preg::Preg;
use shirabe_php_shim::{
- InvalidArgumentException, LogicException, PhpMixed, SORT_NATURAL, UnexpectedValueException,
- array_flip, dirname, r#eval, file_get_contents, get_class, get_debug_type, in_array, is_array,
- is_int, is_null, is_string, ksort, php_dir, realpath, sort, sort_with_flags, str_repeat, strtr,
- trim, usort, var_export,
+ Exception, InvalidArgumentException, LogicException, PhpMixed, SORT_NATURAL,
+ UnexpectedValueException, array_flip, dirname, r#eval, file_get_contents, get_class,
+ get_debug_type, in_array, is_array, is_int, is_null, is_string, ksort, php_dir, realpath, sort,
+ sort_with_flags, str_repeat, strtr, trim, usort, var_export,
};
use crate::installed_versions::InstalledVersions;
@@ -55,7 +55,7 @@ impl FilesystemRepository {
root_package: Option<Box<dyn RootPackageInterface>>,
filesystem: Option<Filesystem>,
) -> Result<Self> {
- let filesystem = filesystem.unwrap_or_else(Filesystem::new);
+ let filesystem = filesystem.unwrap_or_else(|| Filesystem::new(None));
if dump_versions && root_package.is_none() {
return Err(InvalidArgumentException {
message: "Expected a root package instance if $dumpVersions is true".to_string(),
@@ -79,6 +79,10 @@ impl FilesystemRepository {
self.dev_mode
}
+ pub fn get_repo_name(&self) -> String {
+ format!("file ({})", self.file.get_path())
+ }
+
/// Initializes repository (reads file, or remote address).
pub(crate) fn initialize(&mut self) -> Result<()> {
self.inner.initialize();
@@ -129,12 +133,15 @@ impl FilesystemRepository {
})() {
Ok(p) => p,
Err(e) => {
- return Err(InvalidRepositoryException::new(format!(
- "Invalid repository data in {}, packages could not be loaded: [{}] {}",
- self.file.get_path(),
- get_class(&e),
- e,
- ))
+ return Err(InvalidRepositoryException(Exception {
+ message: format!(
+ "Invalid repository data in {}, packages could not be loaded: [{}] {}",
+ self.file.get_path(),
+ get_class(&e),
+ e,
+ ),
+ code: 0,
+ })
.into());
}
};