1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-30 10:36:35 +02:00
joplin/packages/lib/services/interop/InteropService_Importer_EnexToMd.ts

23 lines
704 B
TypeScript
Raw Normal View History

import { ImportExportResult } from './types';
import InteropService_Importer_Base from './InteropService_Importer_Base';
import Folder from '../../models/Folder';
2020-11-05 18:58:23 +02:00
const { filename } = require('../../path-utils');
export default class InteropService_Importer_EnexToMd extends InteropService_Importer_Base {
async exec(result: ImportExportResult) {
2020-11-05 18:58:23 +02:00
const { importEnex } = require('../../import-enex');
2018-02-27 22:04:38 +02:00
let folder = this.options_.destinationFolder;
if (!folder) {
const folderTitle = await Folder.findUniqueItemTitle(filename(this.sourcePath_));
folder = await Folder.save({ title: folderTitle });
}
await importEnex(folder.id, this.sourcePath_, this.options_);
return result;
}
}