add logs on addWatchMapping

This commit is contained in:
Abhinav 2023-02-07 13:29:59 +05:30
parent e697109355
commit 8ac3523c13

View file

@ -4,13 +4,16 @@ import { ipcRenderer } from 'electron';
import { ElectronFile, WatchMapping } from '../types'; import { ElectronFile, WatchMapping } from '../types';
import { getElectronFile } from '../services/fs'; import { getElectronFile } from '../services/fs';
import { getWatchMappings, setWatchMappings } from '../services/watch'; import { getWatchMappings, setWatchMappings } from '../services/watch';
import ElectronLog from 'electron-log';
export async function addWatchMapping( export async function addWatchMapping(
rootFolderName: string, rootFolderName: string,
folderPath: string, folderPath: string,
uploadStrategy: number uploadStrategy: number
) { ) {
ElectronLog.log(`Adding watch mapping: ${folderPath}`);
folderPath = path.normalize(folderPath); folderPath = path.normalize(folderPath);
ElectronLog.log(`Adding watch mapping (normalized): ${folderPath}`);
const watchMappings = getWatchMappings(); const watchMappings = getWatchMappings();
if (isMappingPresent(watchMappings, folderPath)) { if (isMappingPresent(watchMappings, folderPath)) {
throw new Error(`Watch mapping already exists`); throw new Error(`Watch mapping already exists`);