summaryrefslogtreecommitdiff
path: root/src/lexer.l
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-08-18 16:49:01 (GMT)
committerMarius Kintel <marius@kintel.net>2012-08-18 16:49:01 (GMT)
commit13d56f492560dc8bc9ed60d1d0b81cc98b2fd0c0 (patch)
treefd13025fa99c2cf2185af00f31dbaca245c9d88c /src/lexer.l
parentd3a53dd546358da51f15fa2fb7d24919235d3256 (diff)
parent47a06c074fa6321224d5c6d6cc85bf9336fb8765 (diff)
Merge pull request #179 from openscad/issue176
fix issue #176
Diffstat (limited to 'src/lexer.l')
-rw-r--r--src/lexer.l14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lexer.l b/src/lexer.l
index f939330..1e3bd5b 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -122,10 +122,16 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); }
}
}
/* Only accept regular files which exists */
- if (usepath.has_parent_path() && fs::exists(usepath)) {
+ if (usepath.has_parent_path() && fs::exists(usepath) && !fs::is_directory(usepath)) {
handle_dep(usepath.string());
parserlval.text = strdup(usepath.string().c_str());
return TOK_USE;
+ } else {
+ PRINTB("WARNING: Can't open 'use' file '%s'.", filename);
+ if ( filename.size() == 0 )
+ PRINT("WARNING: 'use' filename is blank");
+ else if ( fs::is_directory( usepath ) )
+ PRINTB("WARNING: 'use' file points to a directory: %s",filename);
}
}
}
@@ -217,6 +223,10 @@ void includefile()
finfo = locate_file((fs::path(filepath) / filename).string());
}
+ if (finfo.empty()) {
+ PRINTB("WARNING: Can't find 'include' file '%s'.", filename);
+ }
+
filepath.clear();
path_stack.push_back(finfo.parent_path());
@@ -225,7 +235,7 @@ void includefile()
currmodule->registerInclude(fullname);
yyin = fopen(fullname.c_str(), "r");
if (!yyin) {
- PRINTB("WARNING: Can't open input file '%s'.", filename);
+ PRINTB("WARNING: Can't open 'include' file '%s'.", filename);
path_stack.pop_back();
return;
}
contact: Jan Huwald // Impressum