+
+ {
+ if (e.target.checked) {
+ setSlcItems([...slcItems, item]);
+ } else {
+ setSlcItems(slcItems.filter(v => v !== item));
+ }
+ }}
+ />
+ {item.fileID && }
+
+ {item}
+
+ {
+ setLoading(true);
+ await toggleModDisabled(c, name, instancePath, item, dispatch);
+ setTimeout(() => setLoading(false), 500);
+ }}
+ />
+
+ deleteFile(item, instancesPath, slcItems, rscPacksPath, name)
+ }
+ icon={faTrash}
+ />
+
+
+ );
+ }, areEqual);
+
+ const openFolderDialog = async () => {
+ const dialog = await ipcRenderer.invoke('openFileDialog', [
+ { extensions: ['7zip', 'zip'] }
+ ]);
+ if (dialog.canceled) return;
+ const fileName = path.basename(dialog.filePaths[0]);
+ await fse.copy(
+ dialog.filePaths[0],
+ path.join(instancesPath, instanceName, 'resourcepacks', fileName)
+ );
+ };
+
+ const startListener = async () => {
+ await makeDir(resourcePacksPath);
+ const files = await fs.readdir(resourcePacksPath);
+ setResourcePacks(files);
+ watcher = watch(resourcePacksPath, async (event, filename) => {
+ if (filename) {
+ const resourcePackFiles = await fs.readdir(resourcePacksPath);
+ setResourcePacks(resourcePackFiles);
+ }
+ });
+ };
+
+ useEffect(() => {
+ startListener();
+ return () => watcher?.close();
+ }, []);
+
+ const itemData = createItemData(
+ resourcePacks,
+ instanceName,
+ path.join(instancesPath, instanceName),
+ selectedItems,
+ setSelectedItems,
+ resourcePacksPath
+ );
+
+ return (
+