voxel51 / eta

ETA: Extensible Toolkit for Analytics
https://voxel51.com
Apache License 2.0
29 stars 13 forks source link

Treat empty string as cwd when ensuring directories exist #543

Closed brimoor closed 2 years ago

brimoor commented 2 years ago

Previously ensure_basedir("hi.txt") would fail, since os.path.dirname("hi.txt") == "" and it wasn't clear what that meant. This PR makes it so that dirname == "" is treated as the current working directory, which is assumed to exist.

This choice allows downstream operations to work with paths like "hi.txt" without having to explicitly write "./hi.txt".