qiime2 / q2cli

Command line interface for QIIME 2
BSD 3-Clause "New" or "Revised" License
19 stars 24 forks source link

Expand ~ #322

Closed Oddant1 closed 9 months ago

Oddant1 commented 10 months ago

Closes #308 by expanding the ~ using os.path.expanduser allowing keyed de-facto collection elements to use a path starting with ~.

Oddant1 commented 9 months ago

@gregcaporaso we would need to write to the user's home directory which I wanted to avoid doing. There may be some sort of work around for that, I didn't look too hard for one.

gregcaporaso commented 9 months ago

That makes sense. How about confirming that the resulting path starts with os.environ['HOME']? (And I realize it's incredibly unlikely that this single line of code you're adding is buggy - I'm just aiming to prevent against a regression where someone removes this line because they assume Click is going to handle it.)

Oddant1 commented 9 months ago

@gregcaporaso I just added a kinda real test, seemed like the thing to do. It wasn't difficult to work around writing to home which I figured it wouldn't be. Probably should have just done it already.