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

Expand environment variable in file names for C++ apps #600

Merged
merged 3 commits into from
Aug 20, 2020

Conversation

mainegra
Copy link
Contributor

@mainegra mainegra commented May 21, 2020

Introduces the C++ EGSnrc global function egsExpandPath to search for one environment variable anywhere in the string argument and expand it with its value. It understands Unix ($VAR) and Windows (%VAR%) environment variables, as well as their file separators (backslash or slash). However the file name is output using slashes as file separators. Consequently:

  • Spectrum file names can now include an environment variable such as $EGS_HOME or $HEN_HOUSE
  • C++ apps requesting input of a file name were updated to use this feature
  • egs++ spectrum file names can also use environment variables

This feature matches the functionality already existing for Mortran apps although with added flexibility.

@mainegra mainegra self-assigned this May 21, 2020
@mainegra mainegra changed the base branch from master to develop May 21, 2020 18:38
@ftessier
Copy link
Member

Rebased on develop and applied astyle formatting.

@ftessier
Copy link
Member

ftessier commented Aug 19, 2020

Travis seems down, but I have checked locally that compilation is successful and that there is no conflict when rebasing on develop.

@ftessier
Copy link
Member

Can't merge until Travis completes. Will do then.

Add an egs++ egsExpandPath global function to expand the FIRST
environment variable found anywhere in its string argument:
  - Expands Linux or Windows style environment variable
  - Expands the environment variable
  - Appends folder separator if missing
  - Replaces backslashes with slashes
  - Removes duplicate slashes in the expanded path

This function assumes that there is only one environment variable in the
absolute file path, and that it is a directory.
@ftessier
Copy link
Member

Rebased on develop and fixed merge conflicts in egs_kerma files.

@ftessier ftessier merged commit 8a85055 into develop Aug 20, 2020
@ftessier ftessier deleted the feature-expand-envvars branch August 20, 2020 03:23
@ftessier ftessier changed the title Feature expand environment variable in file names for C++ apps Expand environment variable in file names for C++ apps Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants