Skip to content
Open
Changes from 1 commit
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
21 changes: 17 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,15 @@ struct InitialScanFile {
cache_key: String,
}

fn should_ignore_project_file(
project_type: ProjectType,
file_name: &str,
) -> bool {
file_name.starts_with('.')
|| (project_type == ProjectType::ShaderPack
&& file_name.ends_with(".txt"))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would implement as a whitelist rather than blacklist; only process .jar and .zip and other formats I'm forgetting if any

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK done, is it better now?

impl Profile {
pub async fn get(
path: &str,
Expand Down Expand Up @@ -648,8 +657,10 @@ impl Profile {
&& let Some(file_name) = subdirectory
.file_name()
.and_then(|x| x.to_str())
&& !(project_type == ProjectType::ShaderPack
&& file_name.ends_with(".txt"))
&& !should_ignore_project_file(
project_type,
file_name,
)
{
let file_size = subdirectory
.metadata()
Expand Down Expand Up @@ -1054,8 +1065,10 @@ impl Profile {
if subdirectory.is_file()
&& let Some(file_name) =
subdirectory.file_name().and_then(|x| x.to_str())
&& !(project_type == ProjectType::ShaderPack
&& file_name.ends_with(".txt"))
&& !should_ignore_project_file(
project_type,
file_name,
)
{
let file_size = subdirectory
.metadata()
Expand Down
Loading