From f56dc09d019140e630d55fd1fc43e9afd2c4a960 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Thu, 26 Apr 2018 16:50:19 -0400 Subject: [PATCH] Add `getAbsoluteAttachmentPath` --- app/attachments.js | 4 ++++ preload.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/app/attachments.js b/app/attachments.js index 5703b2264..8ce961b49 100644 --- a/app/attachments.js +++ b/app/attachments.js @@ -123,3 +123,7 @@ exports.getRelativePath = (name) => { const prefix = name.slice(0, 2); return path.join(prefix, name); }; + +// createAbsolutePathGetter :: RoothPath -> RelativePath -> AbsolutePath +exports.createAbsolutePathGetter = rootPath => relativePath => + path.join(rootPath, relativePath); diff --git a/preload.js b/preload.js index d64af8573..60fb78e0b 100644 --- a/preload.js +++ b/preload.js @@ -136,6 +136,7 @@ window.moment.locale(locale); // ES2015+ modules const attachmentsPath = Attachments.getPath(app.getPath('userData')); +const getAbsoluteAttachmentPath = Attachments.createAbsolutePathGetter(attachmentsPath); const deleteAttachmentData = Attachments.createDeleter(attachmentsPath); const readAttachmentData = Attachments.createReader(attachmentsPath); const writeNewAttachmentData = Attachments.createWriterForNew(attachmentsPath); @@ -187,6 +188,7 @@ window.Signal.Migrations.deleteAttachmentData = window.Signal.Migrations.getPlaceholderMigrations = getPlaceholderMigrations; window.Signal.Migrations.writeMessageAttachments = Message.createAttachmentDataWriter(writeExistingAttachmentData); +window.Signal.Migrations.getAbsoluteAttachmentPath = getAbsoluteAttachmentPath; window.Signal.Migrations.loadAttachmentData = loadAttachmentData; window.Signal.Migrations.loadMessage = Message.createAttachmentLoader(loadAttachmentData); window.Signal.Migrations.Migrations0DatabaseWithAttachmentData =