Skip to content

Commit a25dc00

Browse files
dietmarwOpenModelica-Hudson
authored andcommitted
Avoid characters in file names that are illegal in Windows
In https://trac.modelica.org/Modelica/ticket/2024 it was noticed that the help files generated by this OMC script contained the under Windows illegal characters '<' and '>'. This patch fixes that issue. The characters are replaced by something that resambles URI encoding but not quite since using actual "%3C" causes other issues when overly clever browser revert "%3c" into "<" and hence the filename can not be found by the browser. Therefore this patch uses "x3C" and "x3E".
1 parent 1cb219f commit a25dc00

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Examples/GenerateDoc.mos

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,12 @@ function filename \"Replace characters that mess with filesystems and shell expa
113113
input String str;
114114
output String ostr =
115115
OpenModelica.Scripting.stringReplace(
116-
OpenModelica.Scripting.stringReplace(str,\"/\",\"Division\"),
117-
\"*\",\"Multiplication\")
116+
OpenModelica.Scripting.stringReplace(
117+
OpenModelica.Scripting.stringReplace(
118+
OpenModelica.Scripting.stringReplace(str,\"/\",\"Division\"),
119+
\"*\",\"Multiplication\"),
120+
\"<\",\"x3C\"),
121+
\">\",\"x3E\")
118122
;
119123
end filename;
120124

@@ -124,6 +128,8 @@ function uriEncode
124128
algorithm
125129
uri := OpenModelica.Scripting.stringReplace(str,\"'\",\"%27\");
126130
uri := OpenModelica.Scripting.stringReplace(uri,\" \",\"%20\");
131+
uri := OpenModelica.Scripting.stringReplace(uri,\"<\",\"x3C\");
132+
uri := OpenModelica.Scripting.stringReplace(uri,\">\",\"x3E\");
127133
end uriEncode;
128134

129135
function notLast

0 commit comments

Comments
 (0)