Skip to content
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

Variable optimization for absolute path checking methods #5737

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions avocado/core/utils/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ def system_wide_or_base_path(file_path):
:type file_path: str
:rtype: str
"""
if os.path.isabs(file_path):
abs_path = file_path
else:
abs_path = os.path.join(os.path.sep, file_path)
if os.path.exists(abs_path):
return abs_path
return prepend_base_path(file_path)
if not os.path.isabs(file_path):
file_path = os.path.join(os.path.sep, file_path)
if not os.path.exists(file_path):
return prepend_base_path(file_path)
return file_path