diff --git a/tools/patch_updater.py b/tools/patch_updater.py index b636c3d91..b7e64ba89 100644 --- a/tools/patch_updater.py +++ b/tools/patch_updater.py @@ -166,6 +166,14 @@ for patch in patches: msg('Reading patch file %s' % patch_file) if 'path' in patch: patch_root_abs = os.path.abspath(os.path.join(src_dir, patch['path'])) + if not os.path.isdir(patch_root_abs): + line = 'Target directory does not exist: %s' % patch_root_abs + msg(line) + if options.resave: + # Report as a fatal error for manual resave only, as the missing + # directory may be platform-specific. + failed_patches[patch['name']] = [line] + continue else: patch_root_abs = src_dir diff --git a/tools/patcher.py b/tools/patcher.py index 4d7ed34d8..023e91d4b 100644 --- a/tools/patcher.py +++ b/tools/patcher.py @@ -30,7 +30,8 @@ def write_note(type, note): def apply_patch_file(patch_file, patch_dir): ''' Apply a specific patch file in optional patch directory. ''' - patch_path = os.path.join(cef_patch_dir, 'patches', patch_file + '.patch') + patch_name = patch_file + '.patch' + patch_path = os.path.join(cef_patch_dir, 'patches', patch_name) if patch_dir is None or len(patch_dir) == 0: patch_dir = src_dir @@ -39,6 +40,10 @@ def apply_patch_file(patch_file, patch_dir): # Apply patch relative to the Chromium 'src' directory. patch_dir = os.path.join(src_dir, patch_dir) patch_dir = os.path.abspath(patch_dir) + if not os.path.isdir(patch_dir): + sys.stdout.write('\nApply %s in %s\n' % (patch_name, patch_dir)) + sys.stdout.write('... target directory does not exist (skipping).\n') + return 'skip' result = git_apply_patch_file(patch_path, patch_dir) if result == 'fail':