-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle Relative Filepath #110
base: dev
Are you sure you want to change the base?
Conversation
canflood/model/modcom.py
Outdated
base_dir = os.path.dirname(os.path.dirname(__file__)) | ||
parent_dir = os.path.dirname(base_dir) | ||
fp = os.path.join(parent_dir, fp) | ||
fp = os.path.join(self.cf_dir, fp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cefect leveraged self.cf_dir to get base directory path and joined it with filepath.
canflood/model/modcom.py
Outdated
@@ -2106,6 +2104,8 @@ def _par_hndl_chk(self, | |||
assert isinstance(pval, str), '%s.%s expected a filepath '%(sect, varnm) | |||
if pval == '': | |||
raise Error('must provided a valid \'%s.%s\' filepath'%(sect, varnm)) | |||
if not os.path.exists(pval): | |||
pval = os.path.join(self.cf_dir,pval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cefect here checking if the path is not valid then try to join it with base directory. even after this there is an assert statement so it will ensure the created path is valid. Adding this logic is producing correct paths and not showing errors in tests.
Fix for #104
-updated all the hardcoded paths in control files to relative paths.
-Added logic to read relative path, this will now work in all the environments, since its not dependent on absolute paths.
-After adding this logic, Errors related to relative paths are not seen in tests.