while ((dir_ent = readdir (directory_strt)) != NULL) {
if(checkExtension(dir_ent->d_name, {"jar" , "class" } ) )
classPath += directory + dir_ent->d_name + ":";
if(dir_ent->d_type == DT_DIR && !isDotDirectory(dir_ent->d_name) && recursive)
listAllFilesInDirectory(directory + dir_ent->d_name + '/', classPath, true);
}
classPath += directory+ ":";
closedir (directory_strt);
}else
throw VMError{"Could not open directory: " + directory};
}
std::string ClassPath::LocateLibraries( std::vector<std::string> directories, bool recursive = false ){
std::string classPath;
for(auto &directory: directories)
listAllFilesInDirectory(directory, classPath, recursive);
classPath.pop_back();
return classPath;
}