From c2ebcc9dbc52d123331f3eb6935345b8335b82b2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 12 Dec 2016 06:57:42 -0500 Subject: [PATCH] Fix failures on Travis due to broken isDir --- chrome/content/zotero/xpcom/attachments.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 320664019..d5f8ec656 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -796,7 +796,16 @@ Zotero.Attachments = new function(){ throw new Error("'item' must be a Zotero.Item"); } var dir = this.getStorageDirectory(item).path; - yield OS.File.removeDir(dir, { ignoreAbsent: true }); + // Testing for directories in OS.File, used by removeDir(), is broken on Travis, so use nsIFile + if (Zotero.automatedTest) { + let nsIFile = Zotero.File.pathToFile(dir); + if (nsIFile.exists()) { + nsIFile.remove(true); + } + } + else { + yield OS.File.removeDir(dir, { ignoreAbsent: true }); + } yield Zotero.File.createDirectoryIfMissingAsync(dir); return dir; });