Skip to content

Commit

Permalink
Hide hidden files from browse if they are not part of project
Browse files Browse the repository at this point in the history
  • Loading branch information
mls-m5 committed Nov 20, 2023
1 parent 03405dc commit f10465b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/script/browsefileinteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ void internalBeginFileViewInteraction(std::shared_ptr<IEnvironment> env,
root = std::filesystem::current_path();
}

auto addFile = [&](std::filesystem::path file, std::filesystem::path root) {
if (hideHiddenFiles && file.has_filename() &&
auto addFile = [&](std::filesystem::path file,
std::filesystem::path root,
bool isProjectFile) {
if (!isProjectFile && hideHiddenFiles && file.has_filename() &&
file.filename().string().starts_with(".")) {
return;
}
Expand All @@ -117,7 +119,7 @@ void internalBeginFileViewInteraction(std::shared_ptr<IEnvironment> env,
};

for (auto &file : env->project().files()) {
addFile(file, root);
addFile(file, root, true);
}

// If project had no files. Just brows the current directory
Expand All @@ -131,7 +133,7 @@ void internalBeginFileViewInteraction(std::shared_ptr<IEnvironment> env,
++currentLine;
for (auto &it : std::filesystem::directory_iterator{
std::filesystem::absolute(root)}) {
addFile(it.path(), root);
addFile(it.path(), root, false);
}
}

Expand Down

0 comments on commit f10465b

Please sign in to comment.