remove unnecessary normalize

This commit is contained in:
Abhinav 2023-02-07 13:48:54 +05:30
parent b312f5ad9f
commit c3b7442e29

View file

@ -12,8 +12,6 @@ export async function addWatchMapping(
uploadStrategy: number uploadStrategy: number
) { ) {
ElectronLog.log(`Adding watch mapping: ${folderPath}`); ElectronLog.log(`Adding watch mapping: ${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`);
@ -98,21 +96,17 @@ export function registerWatcherFunctions(
ipcRenderer.removeAllListeners('watch-change'); ipcRenderer.removeAllListeners('watch-change');
ipcRenderer.removeAllListeners('watch-unlink'); ipcRenderer.removeAllListeners('watch-unlink');
ipcRenderer.on('watch-add', async (_, filePath: string) => { ipcRenderer.on('watch-add', async (_, filePath: string) => {
filePath = path.normalize( filePath = filePath.split(path.sep).join(path.posix.sep);
filePath.split(path.sep).join(path.posix.sep)
);
await addFile(await getElectronFile(filePath)); await addFile(await getElectronFile(filePath));
}); });
ipcRenderer.on('watch-unlink', async (_, filePath: string) => { ipcRenderer.on('watch-unlink', async (_, filePath: string) => {
filePath = path.normalize( filePath = filePath.split(path.sep).join(path.posix.sep);
filePath.split(path.sep).join(path.posix.sep)
);
await removeFile(filePath); await removeFile(filePath);
}); });
ipcRenderer.on('watch-unlink-dir', async (_, folderPath: string) => { ipcRenderer.on('watch-unlink-dir', async (_, folderPath: string) => {
folderPath = path.normalize( folderPath = folderPath.split(path.sep).join(path.posix.sep);
folderPath.split(path.sep).join(path.posix.sep)
);
await removeFolder(folderPath); await removeFolder(folderPath);
}); });
} }