`find_full_path` deliminator handling
CBroz1 opened this issue · comments
find_full_path
could more flexibly handle deliminator placement in input strings
from element_interface.utils import find_full_path
find_full_path(["/Users/me/"], "Dir") # 1. Successful
find_full_path(["/Users/me/"], "/Dir") # 2. FileNotFoundError
find_full_path(["/Users/me"], "/Dir") # 3. FileNotFoundError
Should both 2 and 3 above fail? I propose we (a) clean the relative_path
argument to remove potential initial deliminators to address 2 above, and (b) try rerunning the for-loop with an a deliminator at the end of each root dir paths to address 3.
Anything that starts with /
is always known to be an absolute path. I think they should fail.
Is that a convention we expect all our users to observe? We should certainly accept full paths; I wouldn't want to change 4. I'm less sure about enforcing 5, when the second argument often comes from user-entered manual tables.
find_full_path(["/Users/me/"], "/Users/me/Dir") # 4. Successful
find_full_path(["/Users/me/"], "Users/me/Dir") # 5. FileNotFoundError