//#define XERR
#include "zipcheck.ih"

void ZipCheck::inspectExerciseSubdir()
{
    Glob glob{};
    size_t nEntries = glob.size();
    
    for (string entry: Glob{})              // inspect all the dir's entries
    {
        if (Stat{ entry }.type() == Stat::DIRECTORY)
        {                                   // subdirs are OK
            --nEntries;

            if (isDotDir(entry))
                continue;
            
            err() << entry << ": nested subdirectories not supported\n";
        }
        else if (isTextFile(entry))         // error if not a text file
        {       
            if (inOrderTxt(entry) or nEntries == 1)
                continue;

            errNotInOrderTxt(entry);
        }
    }
    
}
