Bug #3997

gammalib::expand_env should only expand ~ at the beginning of a path

Added by Knödlseder Jürgen over 2 years ago. Updated over 2 years ago.

Status:ClosedStart date:02/22/2022
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:2.0.0
Duration:

Description

Current, the gammalib::expand_env method expands ~ everywhere in the path, but the method should expand ~ only when a path name starts with that character. In the latter example we expect hallo~ and not hallo/Users/jurgen.

>>> import gammalib
>>> print(gammalib.expand_env('~/hallo'))
/Users/jurgen/hallo
>>> print(gammalib.expand_env('hallo~'))
hallo/Users/jurgen


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen over 2 years ago

  • Status changed from New to Pull request
  • Assigned To set to Knödlseder Jürgen
  • Target version set to 2.0.0
  • % Done changed from 0 to 90

This one was an easy one:

>>> import gammalib
>>> print(gammalib.expand_env('~/hallo'))
/Users/jurgen/hallo
>>> print(gammalib.expand_env('hallo~'))
hallo~

#2 Updated by Knödlseder Jürgen over 2 years ago

  • Status changed from Pull request to Closed
  • % Done changed from 90 to 100

Also available in: Atom PDF