import { ipcMain } from 'electron' ; import { Global } from '../global' ; import { getFoldersSync } from '../utils' ; import manager from './manager' ; export let ResourcePackManager ; export function LoadResourcePack ( ) { ResourcePackManager = new manager ( Global . ResourcePackConfigPath ) ; function load ( ) { ResourcePackManager . loadEnabled ( ) ; const resourcepacks = getFoldersSync ( Global . ResourceFolderPath ) ; resourcepacks . forEach ( resp => ResourcePackManager . load ( resp ) ) ; ResourcePackManager . enableFromConfig ( ) ; ResourcePackManager . save ( ) ; } load ( ) ; ipcMain . on ( 'refresh-resourcepack' , event => { ResourcePackManager . clear ( ) ; load ( ) ; event . returnValue = ResourcePackManager . getDetails ( ) ; } ) ; }