Fix export_targets presubmit on Windows.
It was checking for the vs toolchain in the wrong folders.
Bug: angleproject:6735
Change-Id: Ia64f85b33fb6a1b30ca2ebf8ec86eee579e1e835
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3304634
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/scripts/export_targets.py b/scripts/export_targets.py
index a0809ba..309d405 100755
--- a/scripts/export_targets.py
+++ b/scripts/export_targets.py
@@ -53,7 +53,7 @@
import sys
from typing import * # mypy annotations
-REPO_DIR = pathlib.Path.cwd()
+SCRIPT_DIR = os.path.dirname(__file__)
GN_ENV = dict(os.environ)
# We need to set DEPOT_TOOLS_WIN_TOOLCHAIN to 0 for non-Googlers, but otherwise
@@ -61,12 +61,8 @@
# the Visual Studio files in depot_tools if DEPOT_TOOLS_WIN_TOOLCHAIN is not
# explicitly set to 0.
vs_found = False
-for directory in os.environ['PATH'].split(os.pathsep):
- vs_dir = os.path.join(directory, 'win_toolchain', 'vs_files')
- if os.path.exists(vs_dir):
- vs_found = True
- break
-if not vs_found:
+vs_dir = os.path.join(SCRIPT_DIR, '..', 'third_party', 'depot_tools', 'win_toolchain', 'vs_files')
+if not os.path.isdir(vs_dir):
GN_ENV['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
if len(sys.argv) < 3: