Windows file path fixes

- Fix upgrading of Mozilla-style attachments/storage file paths on upgrade
  (requires re-upgrade)
- Save relative paths using forward slashes for consistency, and convert
  to platform-appropriate slashes on use
This commit is contained in:
Dan Stillman 2016-05-09 02:30:00 -04:00
parent 317b1dfa0f
commit cb8b2bda1b
3 changed files with 28 additions and 10 deletions

View file

@ -177,6 +177,14 @@ describe("Zotero.Attachments", function() {
})
})
describe("#getBaseDirectoryRelativePath()", function () {
it("should convert backslashes to forward slashes", function () {
Zotero.Prefs.set('baseAttachmentPath', "C:\\foo\\bar");
var path = Zotero.Attachments.getBaseDirectoryRelativePath("C:\\foo\\bar\\test\\file.txt");
assert.equal(path, Zotero.Attachments.BASE_PATH_PLACEHOLDER + "test/file.txt");
});
});
describe("#getTotalFileSize", function () {
it("should return the size for a single-file attachment", function* () {
var file = getTestDataDirectory();