From 2b2de0c2720839ae50ff45404297ec0db18fe27a Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Mon, 14 Aug 2017 09:21:36 -0700 Subject: [PATCH] added more checks for path existence --- buildscripts/builddrivers.py | 13 ++++++++----- buildscripts/buildtools.py | 8 +++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/buildscripts/builddrivers.py b/buildscripts/builddrivers.py index 0bb771b0..b429e14a 100644 --- a/buildscripts/builddrivers.py +++ b/buildscripts/builddrivers.py @@ -105,13 +105,16 @@ class BuildDriver(object): source = input("Hit ENTER to reuse '" + self.source_path + "' or provide another path to the Source folder: ") if len(source) == 0: source = self.source_path - - if os.path.exists( source ): + + valid = True + if os.path.exists(source) and os.path.exists(os.path.join(source, 'shared')): + # Checking the existence of 'shared' folder only, assuming + # sqlsrv and/or pdo_sqlsrv are also present if it exists self.source_path = source break - else: - print('The path provided does not exist. Please re-enter.') - + + print("The path provided is invalid. Please re-enter.") + print('Copying source files from', source) os.system('ROBOCOPY ' + source + '\shared ' + work_dir + '\Source\shared /xx /xo ') diff --git a/buildscripts/buildtools.py b/buildscripts/buildtools.py index 6633371a..1436f981 100644 --- a/buildscripts/buildtools.py +++ b/buildscripts/buildtools.py @@ -111,9 +111,15 @@ class BuildUtil(object): shutil.rmtree(os.path.join(phpsrc, 'Release_TS'), ignore_errors=True) def remove_prev_build(self, sdk_dir): - """Remove all binaries and source code in the Release* or Debug* folders""" + """Remove all binaries and source code in the + Release* or Debug* folders according to the current + configuration + """ print('Removing previous build...') build_dir = self.build_abs_path(sdk_dir) + if not os.path.exists(build_dir): + return + os.chdir(build_dir) os.system('DEL *sqlsrv*')