Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore hidden files when uploading add-on #6417

21 changes: 12 additions & 9 deletions src/network/net_addons.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,19 @@ size_t gather_addon_content(const std::string& current_dir,
result[prefix] = {};
size_t nr_files = 0;
for (const std::string& f : g_fs->list_directory(current_dir)) {
if (g_fs->is_directory(f)) {
std::string str = prefix;
if (!str.empty()) {
str += FileSystem::file_separator();
const std::string fname = FileSystem::fs_filename(f.c_str());
if (!fname.empty() && fname.front() != '.') { // Ignore hidden files
if (g_fs->is_directory(f)) {
std::string str = prefix;
if (!str.empty()) {
str += FileSystem::file_separator();
}
str += fname;
nr_files += gather_addon_content(f, str, result);
} else {
result[prefix].insert(fname);
++nr_files;
}
str += FileSystem::fs_filename(f.c_str());
nr_files += gather_addon_content(f, str, result);
} else {
result[prefix].insert(FileSystem::fs_filename(f.c_str()));
++nr_files;
}
}
return nr_files;
Expand Down
Loading