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

[runSofa,Helper] Changes screenshots and config directories location #5096

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

EulalieCoevoet
Copy link
Contributor

The directories screenshots and config are currently created in the build directory of SOFA. When installing the software on a machine, those can end up in a read-only directory.

To avoid this problem, this PR changes:

On Linux:

  • screenshots location to: ~/SOFAData/screenshots/
  • config location to: ~/.config/SOFA/config/

On Windows:

  • screenshots location to: ~/SOFAData/screenshots/
  • config location to: ~/AppData/Local/.config/SOFA/config/

On MacOS:

  • screenshots location to: ~/Library/Application Support/SOFAData/screenshots/
  • config location to: ~/Library/Application Support/.config/SOFA/config/

These changes have only been tested on Linux. I'm not familiar with MacOS so I don't know what would be the best location.


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added the pr: status to review To notify reviewers to review this pull-request label Nov 8, 2024
@hugtalbot hugtalbot changed the title [main] Changes screenshots and config directories location [runSofa,Helper] Changes screenshots and config directories location Nov 13, 2024
@hugtalbot hugtalbot added the enhancement About a possible enhancement label Nov 20, 2024
@hugtalbot
Copy link
Contributor

hugtalbot commented Nov 20, 2024

This links with #4926 from @fredroy, @damienmarchal any thoughts ?

@damienmarchal
Copy link
Contributor

Hi @EulalieCoevoet

Thank for the PR.
It is unclear to me if the choices of directory is the best one.
I would expect the screenshots to be in the "current" directory (the one from which the application is started.
If they don't go there... I would have expected something more like:

On Linux:
screenshots location to: ~/.sofa/screenshots/
config location to: ~/.sofa/config/SOFA/config/
or
screenshots location to: ~/.sofa/screenshots/
config location to: ~/.config/sofa/

On Windows:
screenshots location to: ~/AppData/Local/sofa/screenshots/
config location to: ~/AppData/Local/.config/sofa/config/
or
screenshots location to: ~/AppData/Local/sofa/screenshots/
config location to: ~/AppData/Local/sofa/config/

On MacOS:
screenshots location to: ~/Library/Application Support/sofa/screenshots/
config location to: ~/Library/Application Support/.config/sofa
or
screenshots location to: ~/Library/Application Support/sofa/screenshots/
config location to: ~/Library/Application Support/sofa/config/

@EulalieCoevoet
Copy link
Contributor Author

EulalieCoevoet commented Dec 4, 2024

I'm okay with all your suggestions. If I had to choose, I'll go for:

On Linux:
~/sofa/screenshots/ (we should not hide this directory)
~/sofa/config/

On Windows:
~/AppData/Local/sofa/screenshots/
~/AppData/Local/sofa/config/

On MacOS:
~/Library/Application Support/sofa/screenshots/
~/Library/Application Support/sofa/config/

@bakpaul bakpaul added this to the v24.12 milestone Dec 16, 2024
@bakpaul
Copy link
Contributor

bakpaul commented Dec 16, 2024

Having it in a hidden directory is better in my opinion: for the three other platform, it is kind of hidden by the fact that it is in folders dedicated for such files. Here in linux we are polluting the home of the user. I would then advocate for the use of hidden folder.

Copy link
Contributor

@alxbilger alxbilger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add tests for getUserHomeDirectory and getSofaDataDirectory in Sofa/framework/Helper/test/Utils_test.cpp?

applications/projects/runSofa/Main.cpp Outdated Show resolved Hide resolved
Sofa/framework/Helper/src/sofa/helper/Utils.cpp Outdated Show resolved Hide resolved
@bakpaul bakpaul added the pr: backport todo This PR will be backported into the release preceeding its milestone. label Dec 17, 2024
@hugtalbot hugtalbot removed the pr: backport todo This PR will be backported into the release preceeding its milestone. label Dec 17, 2024
@hugtalbot hugtalbot modified the milestones: v24.12, v25.06 Dec 17, 2024
@hugtalbot
Copy link
Contributor

hugtalbot commented Dec 18, 2024

Default folder could be the first one proposed by Eulalie. Config path on MacOS seems undefined (some in App some others in .config). Although the config folder is OS dependent and quite straightforward, we need to be able to modify the screenshot folder -> configuration of this path in the GUI.

Use of FileSystem::append

Co-authored-by: Alex Bilger <[email protected]>
@hugtalbot
Copy link
Contributor

hugtalbot commented Jan 8, 2025

Hey @EulalieCoevoet

We finally did not have time to take over for the release. Your default proposal suits us. The only things to be added would be:

  • the possibility to redefine the screenshot folder through the config file
  • a documentation page should be added about it

This could be done in a separate PR. Would you be open doing it @EulalieCoevoet ?

@hugtalbot
Copy link
Contributor

hugtalbot commented Jan 15, 2025

TODO : Add tests to check if directories given by getUserHomeDirectory() macthes the one of the CI and same for the other methods (getSofaDataDirectory, getConfigDiretoryPath, getScreenshotDiretoryPath)

@hugtalbot hugtalbot added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Jan 15, 2025
@EulalieCoevoet
Copy link
Contributor Author

Can we run the CI to check the tests?

@fredroy
Copy link
Contributor

fredroy commented Jan 28, 2025

[ci-build][with-all-tests]

@EulalieCoevoet
Copy link
Contributor Author

EulalieCoevoet commented Feb 4, 2025

For the test of getUserHomeDirectory() on Windows.
Do you know if it should be J:\jenkins2 or J:/0 ? Or should I print the results of getUserHomeDirectory() in the CI ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement About a possible enhancement pr: status wip Development in the pull-request is still in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants