Skip to content

Commit

Permalink
Fixed bug with relative paths not being expanded.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Saxe committed Jul 20, 2022
1 parent f78d199 commit bb73267
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions read_structure_step/read_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,21 @@ def run(self):

# Check for tar files, potentially compressed
if isinstance(P["file"], Path):
path = P["file"]
path = P["file"].expanduser().resolve()
else:
path = Path(["file"].strip())
path = Path(P["file"].strip()).expanduser().resolve()

extensions = path.suffixes
if ".tar" in extensions or ".tgz" in extensions:
self.read_tarfile(path, P)
else:
# What type of file?
if isinstance(P["file"], Path):
filename = str(P["file"])
else:
filename = ["file"].strip()
filename = str(path)
file_type = P["file type"]

if file_type != "from extension":
extension = file_type.split()[0]
else:
path = PurePath(filename)
extension = path.suffix
if extension == ".gz":
extension = path.stem.suffix
Expand Down

0 comments on commit bb73267

Please sign in to comment.