Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
592 views
in Technique[技术] by (71.8m points)

modelica - cd command doesn't work in Dymola.mos file

I am trying to configure dymola.mos file, here is an example of changing directory, but when I activate Dymola, it seems the working directory doesn't change at all, even though the log shows Dymola run the script.
My question is:
How could I make the cd command work in the dymola.mos file?

enter image description here

question from:https://stackoverflow.com/questions/65851602/cd-command-doesnt-work-in-dymola-mos-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I assume you have activated the option Save startup directory. You can check this with the flag Advanced.StartupDirectory, which will be either 1 or 2. You can simply turn that off or follow the steps below.

From your command log we see that:

  1. Dymola first executes the script <install-path/insert/dymola.mos
  2. Then it restores the settings stored in setup.dymx

Hence the settings in setup.dymx override your working directory.

Instead of using <install-path/insert/dymola.mos you should use a custom .mos script, which is passed as first argument to dymola.exe on startup. This will always be executed last.

Example for Windows

  • Create the file startup.mos somewhere, e.g. in C:dymolastartup.mos

  • Create a shortcut to Dymola.exe, (for Dymola 2021x: C:Program FilesDymola 2021xin64Dymola.exe)

  • Add the .mos script as argument in the Target field in the properties of the shortcut. The result will be: "C:Program FilesDymola 2021xin64Dymola.exe" "C:dymolastartup.mos"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...