Skip to content

Commit

Permalink
Use compareFilesAndMove instead of system(mv ...). (#10516)
Browse files Browse the repository at this point in the history
  - Use `compareFilesAndMove` instead of `system(mv ...)`.  
    - The first one is more portable.

  - Misc.
    - Change `or` in C++ code to `||`. I must have come straight from Python when I wrote this.
  • Loading branch information
mahge committed Apr 7, 2023
1 parent 2414d51 commit 160a289
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion OMCompiler/Compiler/Script/OpenModelicaScriptingAPI.mos
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if bool then
setCommandLineOptions("-g=MetaModelica");
bool := loadFile("OpenModelicaScriptingAPI.tmp.mo");
if bool then
bool := 0 == system("mv OpenModelicaScriptingAPI.tmp.mo OpenModelicaScriptingAPI.mo");
bool := OpenModelica.Scripting.compareFilesAndMove("OpenModelicaScriptingAPI.tmp.mo", "OpenModelicaScriptingAPI.mo");
else
exit(1);
end if;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ project(OMModelicaExternalC)
link_directories(${CMAKE_INSTALL_LIBDIR} ${CMAKE_INSTALL_BINDIR})

# Set the rpath to the one dir up as the destination of the libs
# when installing is an 'ffi' directory in the lib directory.
# See the install commnad at the end of this file. If that is
# when installing there is an 'ffi' directory in the lib directory.
# See the install command at the end of this file. If that is
# changed make sure to adjust this as well.
if(APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path/../../${CMAKE_INSTALL_LIBDIR}")
Expand Down
4 changes: 2 additions & 2 deletions OMCompiler/SimulationRuntime/ParModelica/auto/om_pm_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void OMModel::load_ODE_system() {
}

inline void check_tag(int index, const std::string& tag) {
if (tag == "dummy" or tag == "assign" or tag == "residual" or tag == "tornsystem" or tag == "system" or
if (tag == "dummy" || tag == "assign" || tag == "residual" || tag == "tornsystem" || tag == "system" ||
tag == "algorithm")
return;
else {
Expand All @@ -120,7 +120,7 @@ inline void check_tag(int index, const std::string& tag) {
}

inline void check_container_dispaly(int index, const std::string& disp) {
if (disp == "linear" or disp == "non-linear")
if (disp == "linear" || disp == "non-linear")
return;
else {
utility::eq_index_fatal(index, "container with unknown disp : " + disp);
Expand Down

0 comments on commit 160a289

Please sign in to comment.