Skip to content

Commit

Permalink
feat: open mods folder button on the mods page
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Nov 11, 2024
1 parent 1bc7dcf commit 589a542
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/components/templates/modpack/ModpackMods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ui-button type="success" @click="searchingForMods = true" icon="plus" :data-balloon-length="instance.locked ? 'medium' : undefined" :aria-label="instance.locked ? 'This instance is locked, to add more content you will need to unlock it in settings.' : 'Add more mods'" :disabled="instance.locked" />
<ui-button type="info" @click="updateAll" icon="download" :data-balloon-length="instance.locked ? 'medium' : undefined" :aria-label="instance.locked ? 'This instance is locked, to add more content you will need to unlock it in settings.' : 'Update all mods'" :disabled="instance.locked || modUpdatesAvailableKeys.length === 0" />
<ui-button type="info" icon="sync" aria-label="Refresh mod list" aria-label-pos="down-right" :disabled="updatingModlist" @click="getModList(true)" />
<ui-button type="info" @click="openModsFolder" icon="folder" data-balloon-length="medium" aria-label="Open mods folder" />
</template>
</div>

Expand Down Expand Up @@ -81,7 +82,14 @@ import FindMods from '@/components/templates/modpack/FindMods.vue';
import FTBSearchBar from '@/components/atoms/input/FTBSearchBar.vue';
import {ModPack} from '@/modules/modpacks/types';
import {sendMessage} from '@/core/websockets/websocketsApi';
import {BaseData, CurseMetadata, InstanceJson, ModInfo, UpdateAvailable} from '@/core/@types/javaApi';
import {
BaseData,
CurseMetadata,
InstanceJson,
ModInfo,
SugaredInstanceJson,
UpdateAvailable
} from '@/core/@types/javaApi';
import {containsIgnoreCase, stringIsEmpty} from '@/utils/helpers/stringHelpers';
import {alertController} from '@/core/controllers/alertController';
import UiButton from '@/components/core/ui/UiButton.vue';
Expand All @@ -92,6 +100,7 @@ import UiToggle from '@/components/core/ui/UiToggle.vue';
import {emitter} from '@/utils';
import ClosablePanel from '@/components/molecules/ClosablePanel.vue';
import {createLogger} from '@/core/logger';
import platform from '@/utils/interface/electron-overwolf';

export type ApiMod = {
fileId: number;
Expand Down Expand Up @@ -261,6 +270,14 @@ export default class ModpackMods extends Vue {
this.updateMod(key).catch(e => this.logger.error(e))
}
}

async openModsFolder() {
if ((this.instance as SugaredInstanceJson).rootDirs.includes("mods")) {
await platform.get.io.openFinder(platform.get.io.pathJoin((this.instance as SugaredInstanceJson).path, "mods"));
} else {
await platform.get.io.openFinder((this.instance as SugaredInstanceJson).path);
}
}

async toggleMod(file: ModInfo) {
this.togglingShas.push(file.sha1)
Expand Down

0 comments on commit 589a542

Please sign in to comment.