Skip to content

Commit

Permalink
Ignore unix like hidden dir entries
Browse files Browse the repository at this point in the history
  • Loading branch information
turleypol committed Dec 28, 2021
1 parent b4cf95f commit 3f884e8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pol-core/ecompile/ECompileMain.cpp
Expand Up @@ -582,7 +582,9 @@ void recurse_compile( const fs::path& basedir, std::vector<std::string>* files )
{
if ( Clib::exit_signalled )
return;
if ( dir_entry.is_directory() )
if ( auto fn = dir_entry.path().filename().u8string(); !fn.empty() && *fn.begin() == '.' )
continue;
else if ( dir_entry.is_directory() )
recurse_compile( dir_entry.path(), files );
else if ( !dir_entry.is_regular_file() )
continue;
Expand Down Expand Up @@ -644,7 +646,9 @@ void recurse_compile_inc( const fs::path& basedir, std::vector<std::string>* fil
{
if ( Clib::exit_signalled )
return;
if ( dir_entry.is_directory() )
if ( auto fn = dir_entry.path().filename().u8string(); !fn.empty() && *fn.begin() == '.' )
continue;
else if ( dir_entry.is_directory() )
recurse_compile_inc( dir_entry.path(), files );
else if ( !dir_entry.is_regular_file() )
continue;
Expand Down
3 changes: 2 additions & 1 deletion pol-core/plib/pkg.cpp
Expand Up @@ -316,7 +316,8 @@ void load_packages( const std::string& basedir, bool quiet )
{
if ( !dir_entry.is_directory() )
continue;
if ( dir_entry.path().stem() == "template" )
if ( auto fn = dir_entry.path().filename().u8string();
!fn.empty() && ( *fn.begin() == '.' || fn == "template" ) )
continue;
const auto pkg_dir = dir_entry.path();
const auto pkg_cfg = pkg_dir / "pkg.cfg";
Expand Down
2 changes: 2 additions & 0 deletions pol-core/pol/cmdlevel.cpp
Expand Up @@ -153,6 +153,8 @@ std::unique_ptr<Bscript::ObjArray> ListCommandsInPackageAtCmdlevel( Plib::Packag
{
if ( !dir_entry.is_regular_file() )
continue;
if ( auto fn = dir_entry.path().filename().u8string(); !fn.empty() && *fn.begin() == '.' )
continue;

const auto ext = dir_entry.path().extension();
if ( !ext.compare( ".ecl" ) )
Expand Down
2 changes: 2 additions & 0 deletions pol-core/pol/module/filemod.cpp
Expand Up @@ -635,6 +635,8 @@ Bscript::BObjectImp* FileAccessExecutorModule::mf_ListDirectory()
std::error_code ec;
for ( const auto& dir_entry : fs::directory_iterator( path, ec ) )
{
if ( auto fn = dir_entry.path().filename().u8string(); !fn.empty() && *fn.begin() == '.' )
continue;
if ( dir_entry.is_directory() )
{
if ( listdirs == 0 )
Expand Down
2 changes: 2 additions & 0 deletions pol-core/pol/realms/realms.cpp
Expand Up @@ -38,6 +38,8 @@ bool load_realms()
{
if ( !dir_entry.is_directory() )
continue;
if ( auto fn = dir_entry.path().filename().u8string(); !fn.empty() && *fn.begin() == '.' )
continue;
const auto realm_name = dir_entry.path().stem().u8string();

passert_r( gamestate.Realms.size() < MAX_NUMER_REALMS,
Expand Down
2 changes: 2 additions & 0 deletions pol-core/pol/tiplstwn.cpp
Expand Up @@ -23,6 +23,8 @@ void load_tips()
{
if ( !dir_entry.is_regular_file() )
continue;
if ( auto fn = dir_entry.path().filename().u8string(); !fn.empty() && *fn.begin() == '.' )
continue;
const auto path = dir_entry.path();
if ( !path.extension().compare( ".txt" ) )
{
Expand Down

0 comments on commit 3f884e8

Please sign in to comment.