Skip to content

Commit

Permalink
allow .conanrc in filesystem root (#16514)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored Jul 1, 2024
1 parent 1989fef commit e8d50c6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions conan/internal/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ def get_conan_user_home():

def _find_conanrc_file():
path = Path(os.getcwd())
while path.is_dir() and len(path.parts) > 1: # finish at '/'
while True:
conanrc_file = path / ".conanrc"
if conanrc_file.is_file():
return conanrc_file
else:
path = path.parent
if len(path.parts) == 1: # finish at '/'
break
path = path.parent

def _user_home_from_conanrc_file():
try:
Expand All @@ -49,8 +50,8 @@ def _user_home_from_conanrc_file():
user_home = conan_expand_user(user_home)
if not os.path.isabs(user_home):
raise ConanException("Invalid CONAN_HOME value '%s', "
"please specify an absolute or path starting with ~/ "
"(relative to user home)" % user_home)
"please specify an absolute or path starting with ~/ "
"(relative to user home)" % user_home)
return user_home


Expand Down

0 comments on commit e8d50c6

Please sign in to comment.