Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Qucs-S workspace and tempfile paths #658

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

wawuwo
Copy link
Contributor

@wawuwo wawuwo commented Mar 23, 2024

Hi!

This pull request addresses three issues described in #145.

  1. Set root path for all temporary files produced by Qucs-S to QStandardPaths::CacheLocation (which is ~/.cache/qucs-s on GNU/Linux)
  2. Set default Qucs-S workspace path to ~/QucsWorkspace
  3. Fix a bug which led to recreation of default workspace dir on app start even if it was changed in app settings

I've tested all three changes, but testing of the first one was incomplete: I've tested only the ngspice simulation because I don't have a single clue how to run other types like VHDL, ASCO, etc. (I am complete noob in electrical engineering to be honest)

@ra3xdh
Copy link
Owner

ra3xdh commented Mar 24, 2024

Thanks. I will test this and share the feedback. It's need to use fresh installation to test this. To test VHDL/Verilog you should install ghdl and iverilog and make it available from $PATH. Then simulate schematic like in this thread: #97 (comment) Digital simulation starts automatically if the schematic contains Digigtal simulation type. I didn't use ASCO for a long time and I am not sure if it works 😄 ASCO works only with qucsator.

@ra3xdh ra3xdh linked an issue Mar 24, 2024 that may be closed by this pull request
@ra3xdh ra3xdh added this to the 24.3.0 milestone Mar 25, 2024
@wawuwo
Copy link
Contributor Author

wawuwo commented Mar 27, 2024

@ra3xdh I've found a bug: directory for simulator output (which is defined in "Simulator settings") is always set to ~/.cache/qucs-s/spice4qucs at app start. In other words custom path for simulator output is respected until app termination only.

I'll prepare a fix to respect user-defined setting after restart. But I'm in doubt: if simulator output is temporary data and temporary data should be stored in standard location, then shouldn't there be no way to set custom simulator output dir?

@ra3xdh
Copy link
Owner

ra3xdh commented Mar 27, 2024

But I'm in doubt: if simulator output is temporary data and temporary data should be stored in standard location

The user normally should not get access to raw SPICE simulator dataset. The output directory setting was implemented for example to redirect output to ramdisk mounted in /tmp. This would allow to achieve automatic clean caches. I think there is no need to set the simulator output directory by user after switching to standard paths. The cache cleaning could be done by means of global system tools.

@wawuwo
Copy link
Contributor Author

wawuwo commented Mar 27, 2024

I think there is no need to set the simulator output directory by user after switching to standard paths

I see; then I'll adjust simulator settings dialog and revert last fix 🤝

wawuwo added a commit to wawuwo/qucs_s that referenced this pull request Mar 27, 2024
This reverts commit 6411ada.

There is no need to have user-defined output dirs. Instead of
respecting user setting we should instead remove the means to
change it and always use standard path.

See: ra3xdh#658 (comment)
wawuwo added a commit to wawuwo/qucs_s that referenced this pull request Mar 27, 2024
Simulator output should be stored in generic dir for temporary
files, there is no need for user-defined simulator output path
and means to define it.

See ra3xdh#658 (comment)
@ra3xdh
Copy link
Owner

ra3xdh commented Apr 7, 2024

I have tested this and found one major issue. The new Qucs-S always sets the project directory to $HOME/QucsWorkspace. The application shown an empty project tree and user libraries list after restart. Users need to move their data manually. This may lead to tons of false positive bugreports after releasing this feature. The following logic should be used here:

  • Don't change projects tree location, if the old project directory QucsSetting.QucsHomeDir (usually points to $HOME/.qucs) contains some projects or user libraries. Probably need to check for _prj subdirectories (projects) and user_lib subdirectory.
  • If there is no contents in $HOME/.qucs then migrate to $HOME/QucsWorkspace
  • Ideally ask user if the data should be migrated and copy contents of $HOME/.qucs to $HOME/QucsWorkspace

Probably you can propose a better solution. I will merge this PR after this issue will be resolved.

@ra3xdh
Copy link
Owner

ra3xdh commented Apr 7, 2024

Also the solution may be to use new workspace location only on the fresh installation of the application. The QucsSettings.firstStart could be used.

@wawuwo
Copy link
Contributor Author

wawuwo commented Apr 7, 2024

@ra3xdh, oh, I see :(
That's because I decided to use another name for config property, "QucsHomeDir" property containing old path is ignored. I'll try to come with a fix today

With this commit the root path for temporary files produced
by Qucs-S is set to StandardPaths::CacheLocation which is
~/.cache/qucs-s on Linux.

This path is set automatically and can't be changed.
This commit
1. changes ~/.qucs to ~/QucsWorkspace
2. assignes more descriptive name to config property which holds
   this path
With this commit creating of workspace dir is done *after* loading
of settings, so the workspace path from settings is taken into
account.

Previous behaviour was to create workspace dir before loading of
settings which led to path from settings to be ignored.

See comment:
 ra3xdh#145 (comment)
Simulator output should be stored in generic dir for temporary
files, there is no need for user-defined simulator output path
and means to define it.

See ra3xdh#658 (comment)
@wawuwo
Copy link
Contributor Author

wawuwo commented Apr 7, 2024

@ra3xdh I implemented it the easy way: if it is a fresh install (no ~/.config/qucs/qucs_s.conf or no property in config), then set ~/QucsWorkspace, otherwise respect the value from config file.

@ra3xdh ra3xdh merged commit 2aecb61 into ra3xdh:current Apr 8, 2024
2 checks passed
@ra3xdh
Copy link
Owner

ra3xdh commented Apr 8, 2024

Thanks! Now everything works correct. Merging.

@wawuwo wawuwo deleted the 145-qucs-dirs-paths branch April 8, 2024 06:32
@zergud zergud mentioned this pull request Apr 12, 2024
iwbnwif added a commit to iwbnwif/qucs_s that referenced this pull request Apr 14, 2024
iwbnwif added a commit to iwbnwif/qucs_s that referenced this pull request Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use xdg base directory specification
2 participants