remove checkAllElectronAPIsExists checks
This commit is contained in:
parent
d233075d94
commit
02c45bb20d
|
@ -70,7 +70,6 @@ class ExportService {
|
|||
private reRunNeeded = false;
|
||||
private exportRecordUpdater = new QueueProcessor<ExportRecord>(1);
|
||||
private stopExport: boolean = false;
|
||||
private allElectronAPIsExist: boolean = false;
|
||||
private fileReader: FileReader = null;
|
||||
private continuousExportEventHandler: () => void;
|
||||
private uiUpdater: ExportUIUpdaters = {
|
||||
|
@ -89,7 +88,6 @@ class ExportService {
|
|||
constructor() {
|
||||
if (runningInBrowser()) {
|
||||
this.electronAPIs = window['ElectronAPIs'];
|
||||
this.allElectronAPIsExist = !!this.electronAPIs?.exists;
|
||||
this.fileReader = new FileReader();
|
||||
}
|
||||
}
|
||||
|
@ -372,10 +370,7 @@ class ExportService {
|
|||
total: removedFileUIDs.length + filesToExport.length,
|
||||
});
|
||||
};
|
||||
if (
|
||||
renamedCollections?.length > 0 &&
|
||||
this.checkAllElectronAPIsExists()
|
||||
) {
|
||||
if (renamedCollections?.length > 0) {
|
||||
addLogLine(
|
||||
`renaming ${renamedCollections.length} collections`
|
||||
);
|
||||
|
@ -1050,7 +1045,5 @@ class ExportService {
|
|||
checkExistsAndCreateDir = (path: string) => {
|
||||
return this.electronAPIs.checkExistsAndCreateDir(path);
|
||||
};
|
||||
|
||||
checkAllElectronAPIsExists = () => this.allElectronAPIsExist;
|
||||
}
|
||||
export default new ExportService();
|
||||
|
|
|
@ -46,9 +46,7 @@ export async function migrateExportJSON() {
|
|||
return;
|
||||
}
|
||||
const exportRecord = await exportService.getExportRecord(exportDir);
|
||||
if (exportService.checkAllElectronAPIsExists()) {
|
||||
await migrateExport(exportDir, exportRecord);
|
||||
}
|
||||
await migrateExport(exportDir, exportRecord);
|
||||
} catch (e) {
|
||||
logError(e, 'migrateExportJSON failed');
|
||||
}
|
||||
|
@ -181,7 +179,6 @@ export async function migrateCollectionFolders(
|
|||
);
|
||||
const newCollectionExportPath = getUniqueCollectionFolderPath(
|
||||
exportDir,
|
||||
collection.id,
|
||||
collection.name
|
||||
);
|
||||
collectionIDPathMap.set(collection.id, newCollectionExportPath);
|
||||
|
@ -217,8 +214,7 @@ async function migrateFiles(
|
|||
file = mergeMetadata([file])[0];
|
||||
const newFileSaveName = getUniqueFileSaveName(
|
||||
collectionIDPathMap.get(file.collectionID),
|
||||
file.metadata.title,
|
||||
file.id
|
||||
file.metadata.title
|
||||
);
|
||||
|
||||
const newFileSavePath = getFileSavePath(
|
||||
|
|
|
@ -42,12 +42,8 @@ export const oldSanitizeName = (name: string) =>
|
|||
|
||||
export const getUniqueCollectionFolderPath = (
|
||||
dir: string,
|
||||
collectionID: number,
|
||||
collectionName: string
|
||||
): string => {
|
||||
if (!exportService.checkAllElectronAPIsExists()) {
|
||||
return getOldCollectionFolderPath(dir, collectionID, collectionName);
|
||||
}
|
||||
let collectionFolderPath = `${dir}/${sanitizeName(collectionName)}`;
|
||||
let count = 1;
|
||||
while (exportService.exists(collectionFolderPath)) {
|
||||
|
@ -64,12 +60,8 @@ export const getMetadataFolderPath = (collectionFolderPath: string) =>
|
|||
|
||||
export const getUniqueFileSaveName = (
|
||||
collectionPath: string,
|
||||
filename: string,
|
||||
fileID: number
|
||||
filename: string
|
||||
) => {
|
||||
if (!exportService.checkAllElectronAPIsExists()) {
|
||||
return getOldFileSaveName(filename, fileID);
|
||||
}
|
||||
let fileSaveName = sanitizeName(filename);
|
||||
let count = 1;
|
||||
while (
|
||||
|
|
Loading…
Reference in a new issue