-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for relative path for nested include #28
Conversation
a175521
to
737afae
Compare
@loicgasser - I'll need to get some time to review this in more detail. Thanks for the comments and pull request. From memory I was using the |
ok thanks, I can adapt/change it if you guide me. |
49c4e37
to
7bd5fbc
Compare
@@ -66,11 +68,9 @@ def open_file(self, fn): | |||
raise | |||
|
|||
def parse_file(self, fn): | |||
|
|||
self.cwd = os.path.dirname(fn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main issue was that. always the same cwd which was overriden here
|
||
assert (len(parts) == 2) | ||
assert (parts[0].lower() == 'include') | ||
fn = os.path.join(self.cwd, self.strip_quotes(parts[1])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and as a result this would not follow relative nested paths.
@loicgasser - thanks for this. Merged. I increased the line length for flake8 as the default of 80 is quite low. |
Not sure what you tried to accomplish with cwd, append absolute paths?
According to me in mapfile you have either
It seems that it was overriden every time when calling
parse_file
, which is not something I'd expect and I couldn't find any test for cwd argument.Hope that you are happy with these changes.
In the utils section I added all the options you can give the parser (namely
add_linebreaks
forloads
andexpand_includes
+add_linebreaks
forload
)DOC:
http://mapserver.org/mapfile/include.html