From ef6aa8561f9dd3ad4d0d7d956b74b71846eb0399 Mon Sep 17 00:00:00 2001 From: Josh Goldman Date: Tue, 28 Feb 2023 08:25:27 -0800 Subject: [PATCH] exists() in mock Destination uses file prefix BUG=232966000 PiperOrigin-RevId: 512939989 Change-Id: I227db28e363bd4aa5c139e6134f91eb5cd21d3b4 --- .../copybara/testing/RecordsProcessCallDestination.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/com/google/copybara/testing/RecordsProcessCallDestination.java b/java/com/google/copybara/testing/RecordsProcessCallDestination.java index 41fae8d3e..9609ffa94 100644 --- a/java/com/google/copybara/testing/RecordsProcessCallDestination.java +++ b/java/com/google/copybara/testing/RecordsProcessCallDestination.java @@ -243,7 +243,11 @@ public void copyDestinationFilesToDirectory(Glob glob, Path directory) @Override public boolean exists(String path) { - return Files.exists(filePrefix.resolve(path)); + if (filePrefix != null) { + return Files.exists(filePrefix.resolve(path)); + } else { + return Files.exists(Path.of(path)); + } } }; }