mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-16 19:46:19 +02:00
Misc fixes for file explorer.
- Add validation while dropping a file - Refactor removing file to work on path not reference - style fixes
This commit is contained in:
@@ -85,3 +85,13 @@ export function removeFileAtPath(files, path) {
|
||||
const { index } = getChildFileFromName(currentFolder, pathPieces[0]);
|
||||
currentFolder.splice(index, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a file with same name exists in the passed folder.
|
||||
* @param {object} folder Folder to search in
|
||||
* @param {string} fileName File name to search for
|
||||
*/
|
||||
export function doesFileExistInFolder(folder, fileName) {
|
||||
const details = getChildFileFromName(folder.children, fileName);
|
||||
return !!details.file;
|
||||
}
|
||||
|
Reference in New Issue
Block a user