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

Simplified some of TRestTools methods using <filesystem> and avoid usage of env variables #229

Merged
merged 5 commits into from
May 26, 2022

Conversation

lobis
Copy link
Member

@lobis lobis commented May 26, 2022

lobis Medium: 104

Before C++17 we had to do some complicated logic to work with paths, this is solved with the ` header, now present at REST.

Some methods to work with paths in REST relied on environment variables to work, such as PWD. This was causing some unexpected issues on my dev environment when the PWD env variable doesn't match the current working directory.

I have removed all apperances of environment variables when working on paths and I have rewritten the old methods to use <filesystem>. Now these methods are a single line and could probably be removed altogether so people start using the filesystem library, but they remain for now.

I removed the method TRestTools::ReturnToPreviousDirectory as it relied on environment variables for state management and it was only used once in the whole code base. I replaced its usage in restG4.

Related PR:

lobis added 3 commits May 26, 2022 08:38
…`TRestTools::ReturnToPreviousDirectory` and replaced its single usage in `restG4` with simpler logic (without env variables!)
@lobis lobis marked this pull request as ready for review May 26, 2022 09:01
@lobis lobis requested a review from DavidDiezIb May 26, 2022 12:22
Copy link
Member

@jgalan jgalan left a comment

Choose a reason for hiding this comment

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

Just tested that I could launch restG4 from a different directory. It was working as expected.

@lobis lobis merged commit 652127b into master May 26, 2022
@lobis lobis deleted the lobis-filesystem branch May 26, 2022 15:03
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.

None yet

4 participants