Opened 11 years ago
Closed 11 years ago
#2731 closed defect (fixed)
classDirectory() does not conform to uses in commercial libraries
Reported by: | Henrik Tidefelt | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: | Martin Sjölund |
Description
The example in #1184 uses classDirectory()
in the following way that is also seen in commercial libraries:
classDirectory() + ".."
In other words, it is assumed that the resulting string has a trailing directory separator.
Some commercial libraries also use classDirectory()
under the assumption that the resulting string is an absolute directory name.
Currently, classDirectory()
conforms to neither of these assumptions.
If this non-standard feature is provided to support commercial libraries, and unless there are examples out there that rely on relative directory names or the absence of the trailing separator, these incompatibilities should be fixed.
Please comment with any examples out there that rely on the current behavior.
Change History (7)
comment:1 by , 11 years ago
Cc: | added |
---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
r21269 appends a "/" or "\" depending on platform, so the given pattern works.
comment:4 by , 11 years ago
Good to have the trailing separator, but doesn't classDirectory()
always use the "/", just like loadResource
and other Modelica functions? I did some testing under Windows which seems to confirm this.
My apologies regarding the absoluteness of paths; it works as expected in OpenModelica.
comment:5 by , 11 years ago
So you want it to always use "/" regardless of platform? I can change that easily.
comment:6 by , 11 years ago
Seams reasonable to me. I suppose you would get odd-looking results like c:/blah/blah\ on Windows otherwise.
Regarding which separator to use, I'm just guessing that using only "/" rather than only native separators is going to work better when the result of classDirectory()
is used in combination with other functions.
How do you make it not return an absolute path? Parser.mo forces all loaded files to have an absolute path.