Skip to content

Commit

Permalink
removed use of 17 fs::directory_iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
lausdahl committed May 29, 2020
1 parent ea54507 commit cfd2b30
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -76,7 +76,7 @@ add_subdirectory(thirdparty/googletest)
add_subdirectory(thirdparty/rabbitmq-c)
add_subdirectory(thirdparty/date)
add_subdirectory(rabbitmq-core)
if (APPLE)
if (UNIX)
add_subdirectory(rabbitmq-tla-tester)
endif()
add_subdirectory(rabbitmq-fmu)
Expand Down
35 changes: 19 additions & 16 deletions rabbitmq-tla-tester/src/TlaTester.cpp
Expand Up @@ -5,27 +5,14 @@
#include <vector>
#include <fstream>


#include <filesystem>


#include <algorithm>

#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"

#include <iostream>

#include "FmuContainerCore.h"


#include <iostream>

#include "date/date.h"
#include <dirent.h>


namespace fs = std::filesystem;

using namespace std;
using namespace rapidjson;
Expand Down Expand Up @@ -476,7 +463,23 @@ int main(int argc, char **argv) {
if (verbose) {
cout << "Searching for tests in path: " << searchPath << endl;
}
for (const auto &entry : fs::directory_iterator(searchPath)) {

DIR *dir;
struct dirent *ent;
if ((dir = opendir (searchPath.c_str())) != NULL) {
/* print all the files and directories within directory */
while ((ent = readdir (dir)) != NULL) {
// printf ("%s\n", ent->d_name);
testFiles.push_back(ent->d_name);
}
closedir (dir);
} else {
/* could not open directory */
perror ("");
return EXIT_FAILURE;
}

/* for (const auto &entry : fs::directory_iterator(searchPath)) {
auto fn = entry.path().generic_string();
if (fn.substr(fn.find_last_of(".") + 1) == "json") {
if (verbose) {
Expand All @@ -485,7 +488,7 @@ int main(int argc, char **argv) {
testFiles.push_back(fn);
}
}
}*/
}
if (verbose) {
cout << "Testing..." << endl;
Expand Down

0 comments on commit cfd2b30

Please sign in to comment.