Skip to content

Commit 6ce9cb3

Browse files
committed
- Fix LibraryDirectory and IncludeDirectory defaults
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15244 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 120ce43 commit 6ce9cb3

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Compiler/BackEnd/SimCodeUtil.mo

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9403,21 +9403,21 @@ protected function generateExtFunctionIncludeDirectoryFlags
94039403
algorithm
94049404
outDirs := matchcontinue (program, path, inMod, includes)
94059405
local
9406-
String str;
9406+
String str,istr;
94079407
case (_, _, _, {}) then {};
94089408
case (_, _, _, _)
94099409
equation
94109410
SCode.MOD(binding = SOME((Absyn.STRING(str), _))) =
94119411
Mod.getUnelabedSubMod(inMod, "IncludeDirectory");
94129412
str = CevalScript.getFullPathFromUri(program, str, false);
9413-
str = "\"-I"+&str+&"\"";
9414-
then {str};
9413+
istr = "\"-I"+&str+&"\"";
9414+
then Util.if_(System.directoryExists(str), {istr}, {});
94159415
case (_, _, _, _)
94169416
equation
9417-
str = "modelica://" +& Absyn.pathStringNoQual(path) +& "/Resources/Include";
9417+
str = "modelica://" +& Absyn.pathFirstIdent(path) +& "/Resources/Include";
94189418
str = CevalScript.getFullPathFromUri(program, str, false);
9419-
str = "\"-I"+&str+&"\"";
9420-
then {str};
9419+
istr = "\"-I"+&str+&"\"";
9420+
then Util.if_(System.directoryExists(str), {istr}, {});
94219421
// Read Absyn.Info instead?
94229422
else {};
94239423
end matchcontinue;
@@ -9446,18 +9446,22 @@ algorithm
94469446
str1 = Util.if_(platform1 ==& "", "", "\"-L" +& str +& "/" +& platform1 +& "\"");
94479447
str2 = Util.if_(platform2 ==& "", "", "\"-L" +& str +& "/" +& platform2 +& "\"");
94489448
str3 ="\"-L" +& str +& "\"";
9449-
libs = str1::str2::str3::libs;
9449+
libs = List.consOnTrue(System.directoryExists(str +& "/" +& platform1), str1, libs);
9450+
libs = List.consOnTrue(System.directoryExists(str +& "/" +& platform2), str2, libs);
9451+
libs = List.consOnTrue(System.directoryExists(str), str3, libs);
94509452
then libs;
94519453
case (_, _, _, libs)
94529454
equation
9453-
str = "modelica://" +& Absyn.pathStringNoQual(path) +& "/Resources/Library";
9455+
str = "modelica://" +& Absyn.pathFirstIdent(path) +& "/Resources/Library";
94549456
str = CevalScript.getFullPathFromUri(program, str, false);
94559457
platform1 = System.openModelicaPlatform();
94569458
platform2 = System.modelicaPlatform();
94579459
str1 = Util.if_(platform1 ==& "", "", "\"-L" +& str +& "/" +& platform1 +& "\"");
94589460
str2 = Util.if_(platform2 ==& "", "", "\"-L" +& str +& "/" +& platform2 +& "\"");
94599461
str3 ="\"-L" +& str +& "\"";
9460-
libs = str1::str2::str3::libs;
9462+
libs = List.consOnTrue(System.directoryExists(str +& "/" +& platform1), str1, libs);
9463+
libs = List.consOnTrue(System.directoryExists(str +& "/" +& platform2), str2, libs);
9464+
libs = List.consOnTrue(System.directoryExists(str), str3, libs);
94619465
then libs;
94629466
else inLibs;
94639467
end matchcontinue;

0 commit comments

Comments
 (0)