From: Mikko Rasa Date: Fri, 10 Oct 2014 10:25:31 +0000 (+0300) Subject: Only get DataTransform directory contents when needed X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=f0b65135c4a9d1b2a90ae446c27837b50ba6ba35;p=builder.git Only get DataTransform directory contents when needed --- diff --git a/source/datatransform.cpp b/source/datatransform.cpp index 67b892e..31aaa37 100644 --- a/source/datatransform.cpp +++ b/source/datatransform.cpp @@ -28,15 +28,23 @@ void DataTransform::find_dependencies() else { builder.get_logger().log("files", format("Reading imports from %s", path.str())); - - list dir_files = list_files(FS::dirname(path)); IO::File in(path.str()); DataFile::Parser parser(in, path.str()); + + list dir_files; while(!in.eof()) { DataFile::Statement st = parser.parse(); if(st.keyword=="for_each") { + // There's bound to be at least one file: the transform itself + if(dir_files.empty()) + { + FS::Path dir = FS::dirname(path); + builder.get_logger().log("files", format("Traversing %s", dir.str())); + dir_files = list_files(dir); + } + for(DataFile::Statement::Arguments::const_iterator i=st.args.begin(); i!=st.args.end(); ++i) { Regex re(i->get());