Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit ed4c02a

Browse files
kananbPorges
andauthored
Look for azcopy.exe in AZCOPY if it's a directory (#3344)
* Look for azcopy.exe in AZCOPY if it's a directory * Make file check in AZCOPY dir more concise Co-authored-by: George Pollard <gpollard@microsoft.com> * Add logic to support searching for azcopy on linux --------- Co-authored-by: George Pollard <gpollard@microsoft.com>
1 parent 6ea2faa commit ed4c02a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/cli/onefuzz/azcopy.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,20 @@
55

66
def find_azcopy() -> str:
77
azcopy = os.environ.get("AZCOPY")
8+
binary_name = "azcopy" if os.name == "posix" else "azcopy.exe"
89

910
if azcopy:
1011
if not os.path.exists(azcopy):
1112
raise Exception(f"AZCOPY environment variable is invalid: {azcopy}")
13+
elif os.path.isdir(azcopy):
14+
contains_azcopy = os.path.isfile(os.path.join(azcopy, binary_name))
15+
16+
if contains_azcopy:
17+
azcopy = os.path.join(azcopy, binary_name)
18+
else:
19+
raise Exception(
20+
f"The directory specified by AZCOPY doesn't contain the file '{binary_name}': {azcopy}"
21+
)
1222
else:
1323
azcopy = shutil.which("azcopy")
1424

0 commit comments

Comments
 (0)