Skip to content

Commit

Permalink
Clarify file-system mapping of Modelica URI (not) ending in '/'
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Nov 7, 2023
1 parent 379c3bf commit eb4c06f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions chapters/packages.tex
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ \section{External Resources}\label{external-resources}
The second segment of the path shall not be the name of a class in the package given by the first segment.
As above for \filename{Modelica 3.2.1/package.mo}, i.e., resources starting from \filename{Modelica 3.2.1}, and \filename{modelica:/Modelica.Mechanics/C.jpg} is \filename{Modelica 3.2.1/Mechanics/C.jpg} -- regardless of whether \lstinline!Modelica.Mechanics! is stored in \filename{Modelica 3.2.1/package.mo}, \filename{Modelica 3.2.1/Mechanics.mo}, or \filename{Modelica 3.2.1/Mechanics/package.mo}.

When mapping a Modelica URI to a file-system path, the file-system path shall end in a directory separator if and only if the URI path ends in the segment separator `\lstinline!/!'.
For example, if \filename{modelica:/A/Resources} maps to \filename{A/Resources}, then \filename{modelica:/A/Resources/} maps to \filename{A/Resources/}, and vice versa.

\begin{nonnormative}
The use of a trailing segment separator is recommended when the resource is a directory and the file-system path will be prepended to relative file paths within the directory.
\end{nonnormative}

For a Modelica-package stored as a single file, \filename{A.mo}, the resource \filename{modelica:/A/C.jpg} refers to a file \filename{C.jpg} stored in the same directory as \filename{A.mo}, but using resources in this variant is not recommended since multiple packages will share resources.

In case the name of the class contains quoted identifiers, the single-quote `\lstinline!`!' and any reserved characters (`\lstinline!:!', `\lstinline!/!', `\lstinline!?!', `\lstinline!\#!', `\lstinline![!', `\lstinline!]!', `\lstinline!@!', `\lstinline!!!', `\lstinline[mathescape=false]!\$!', `\lstinline!\&!', `\lstinline!(!', `\lstinline!)!', `\lstinline!*!', `\lstinline!+!', `\lstinline!,!', `\lstinline!;!', `\lstinline!=!') should be percent-encoded as normal in URIs.
Expand Down

0 comments on commit eb4c06f

Please sign in to comment.