Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions packages/app-lib/src/state/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,25 @@
cache_key: String,
}

fn is_scannable_project_file(
project_type: ProjectType,
file_name: &str,
) -> bool {
let Some(extension) = Path::new(file_name.trim_end_matches(".disabled"))
.extension()
.and_then(|ext| ext.to_str())
else {
return false;
};

match project_type {
ProjectType::Mod => extension.eq_ignore_ascii_case("jar"),
ProjectType::DataPack
| ProjectType::ResourcePack
| ProjectType::ShaderPack => extension.eq_ignore_ascii_case("zip"),
}
}

impl Profile {
pub async fn get(
path: &str,
Expand Down Expand Up @@ -648,8 +667,10 @@
&& let Some(file_name) = subdirectory
.file_name()
.and_then(|x| x.to_str())
&& !(project_type == ProjectType::ShaderPack
&& file_name.ends_with(".txt"))
&& is_scannable_project_file(
project_type,
file_name,
)
{
let file_size = subdirectory
.metadata()
Expand Down Expand Up @@ -1049,11 +1070,13 @@
{
let subdirectory =
subdirectory.map_err(io::IOError::from)?.path();
if subdirectory.is_file()

Check warning on line 1073 in packages/app-lib/src/state/profiles.rs

View workflow job for this annotation

GitHub Actions / Lint and Test

Diff in /home/runner/work/code/code/packages/app-lib/src/state/profiles.rs
&& let Some(file_name) =
subdirectory.file_name().and_then(|x| x.to_str())
&& !(project_type == ProjectType::ShaderPack
&& file_name.ends_with(".txt"))
&& is_scannable_project_file(
project_type,
file_name,
)
{
let file_size = subdirectory
.metadata()
Expand Down
Loading