File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,33 @@ int main(int argc, char **argv)
9595 return 1 ;
9696 }
9797
98+ // TODO: move this logic into simplecpp?
99+ {
100+ bool inc_missing = false ;
101+ for (const std::string& inc : dui.includes ) {
102+ std::fstream f (inc, std::ios::in|std::ios::out); // check if this is an existing file
103+ if (!f.is_open ()) {
104+ inc_missing = true ;
105+ std::cout << " error: could not open include '" << inc << " '" << std::endl;
106+ }
107+ }
108+ if (inc_missing)
109+ return 1 ;
110+ }
111+ {
112+ bool inc_missing = false ;
113+ for (const std::string& inc : dui.includePaths ) {
114+ // TODO: check if this is a directory
115+ std::ifstream f (inc);
116+ if (!f.is_open ()) {
117+ inc_missing = true ;
118+ std::cout << " error: could not find include path '" << inc << " '" << std::endl;
119+ }
120+ }
121+ if (inc_missing)
122+ return 1 ;
123+ }
124+
98125 if (!filename) {
99126 std::cout << " Syntax:" << std::endl;
100127 std::cout << " simplecpp [options] filename" << std::endl;
You can’t perform that action at this time.
0 commit comments