Skip to content
Snippets Groups Projects
Commit e8b9e32e authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix for using test data directories

parent c8503891
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,8 @@ namespace config {
typedef nlohmann::json json_t;
void addPath(const std::string &path);
std::optional<std::string> locateFile(const std::string &name);
std::map<std::string, std::string> read_options(char ***argv, int *argc);
......
......@@ -106,6 +106,11 @@ bool ftl::create_directory(const std::string &path) {
#endif
}
void ftl::config::addPath(const std::string &path) {
auto &paths = rootCFG->getConfig()["paths"];
paths.push_back(path);
}
optional<string> ftl::config::locateFile(const string &name) {
if (is_file(name)) return name;
......
......@@ -92,7 +92,7 @@ ftl::rgbd::detail::Source *Source::_createFileImpl(const ftl::URI &uri) {
if (eix == string::npos) {
// Might be a directory
if (ftl::is_directory(path)) {
return new StereoVideoSource(this);
return new StereoVideoSource(this, path);
} else {
return nullptr;
}
......
......@@ -31,12 +31,15 @@ StereoVideoSource::~StereoVideoSource() {
}
void StereoVideoSource::init(const string &file) {
LOG(INFO) << "STEREOSOURCE = " << file;
if (ftl::is_video(file)) {
// Load video file
LOG(INFO) << "Using video file...";
lsrc_ = ftl::create<LocalSource>(host_, "feed", file);
}
else if (file != "") {
} else if (ftl::is_directory(file)) {
// FIXME: This is not an ideal solution...
ftl::config::addPath(file);
auto vid = ftl::locateFile("video.mp4");
if (!vid) {
LOG(FATAL) << "No video.mp4 file found in provided paths (" << file << ")";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment