commit c2ebcc9dbc52d123331f3eb6935345b8335b82b2
parent 3f325237092d2babccaae7042e52ecf75151d73c
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 12 Dec 2016 06:57:42 -0500
Fix failures on Travis due to broken isDir
Diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git 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;
});