-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from Riverscapes/dev
0.5.2 HOTFIX For filepaths on OSX
- Loading branch information
Showing
7 changed files
with
65 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.5.1" | ||
__version__ = "0.5.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" handling of paths across operating systems | ||
NOTE: this originally came from riverscapes-tools and was unit tested there | ||
""" | ||
from pathlib import Path, PurePosixPath | ||
|
||
|
||
def parse_rel_path(path: str) -> str: | ||
""" Path handling across platforms is gnarly. | ||
This method returns the correct path for your operating system regardless of | ||
whether the input is a windows path or a linux path | ||
Args: | ||
path ([type]): [description] | ||
Returns: | ||
[type]: [description] | ||
""" | ||
new_path = Path(path.replace('\\', '/')).resolve() | ||
return str(new_path) | ||
|
||
|
||
def parse_posix_path(path: str) -> str: | ||
"""This method returns a posix path no matter if you pass it a windows or a linux path | ||
Args: | ||
path ([type]): [description] | ||
""" | ||
new_path = PurePosixPath(path.replace('\\', '/')) | ||
return str(new_path) |