Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/navigation/NavigationMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default class NavigationMenu extends Vue {
await throwIfNoGameDir(this.activeGame);

if (mode === LaunchMode.MODDED) {
await linkProfileFiles(this.activeGame, this.profile);
await linkProfileFiles(this.activeGame, this.profile.asImmutableProfile());
}

this.$store.commit("openGameRunningModal");
Expand Down
8 changes: 4 additions & 4 deletions src/r2mm/manager/ModLinker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import R2Error from '../../model/errors/R2Error';
import Profile from '../../model/Profile';
import { ImmutableProfile } from '../../model/Profile';
import FileWriteError from '../../model/errors/FileWriteError';

import * as path from 'path';
Expand All @@ -15,7 +15,7 @@ import { PackageLoader } from "../../model/installing/PackageLoader";

export default class ModLinker {

public static async link(profile: Profile, game: Game): Promise<string[] | R2Error> {
public static async link(profile: ImmutableProfile, game: Game): Promise<string[] | R2Error> {
if (game.packageLoader == PackageLoader.BEPINEX) {
if (process.platform === 'linux') {
const isProton = await (GameDirectoryResolverProvider.instance as LinuxGameDirectoryResolver).isProtonGame(game);
Expand Down Expand Up @@ -56,7 +56,7 @@ export default class ModLinker {
// Is this 100% needed?
// Could move to a setting at a later date?
// TBD: Only apply when starting vanilla?
private static async cleanupLinkedFiles(profile: Profile, installDirectory: string, previouslyLinkedFiles: string[]) {
private static async cleanupLinkedFiles(profile: ImmutableProfile, installDirectory: string, previouslyLinkedFiles: string[]) {
const fs = FsProvider.instance;
await LoggerProvider.instance.Log(LogSeverity.INFO, `Files to remove: \n-> ${previouslyLinkedFiles.join('\n-> ')}`);
for (const file of previouslyLinkedFiles) {
Expand Down Expand Up @@ -93,7 +93,7 @@ export default class ModLinker {
}
}

private static async performLink(profile: Profile, game: Game, installDirectory: string): Promise<string[] | R2Error> {
private static async performLink(profile: ImmutableProfile, game: Game, installDirectory: string): Promise<string[] | R2Error> {
const fs = FsProvider.instance;
const newLinkedFiles: string[] = [];
try {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/LaunchUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Profile from "../model/Profile";
import Profile, { ImmutableProfile } from "../model/Profile";
import R2Error from "../model/errors/R2Error";
import Game from "../model/game/Game";
import FsProvider from "../providers/generic/file/FsProvider";
Expand All @@ -19,7 +19,7 @@ export const launch = async (game: Game, profile: Profile, mode: LaunchMode): Pr
}
};

export const linkProfileFiles = async (game: Game, profile: Profile): Promise<void> => {
export const linkProfileFiles = async (game: Game, profile: ImmutableProfile): Promise<void> => {
const settings = await ManagerSettings.getSingleton(game);

const newLinkedFiles = await ModLinker.link(profile, game);
Expand Down
6 changes: 3 additions & 3 deletions test/jest/__tests__/impl/ModLinker/ModLinker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const def = () => describe('ModLinker (win32)', () => {
const testFile = Profile.getActiveProfile().joinToProfilePath("test_file");
await FsProvider.instance.writeFile(testFile, "content");
expect(await FsProvider.instance.exists(path.join(settings.getContext().gameSpecific.gameDirectory!, "test_file"))).toBeFalsy();
await ModLinker.link(Profile.getActiveProfile(), GameManager.defaultGame);
await ModLinker.link(Profile.getActiveAsImmutableProfile(), GameManager.defaultGame);
expect(await FsProvider.instance.exists(path.join(settings.getContext().gameSpecific.gameDirectory!, "test_file"))).toBeTruthy();
});

Expand All @@ -61,7 +61,7 @@ const def = () => describe('ModLinker (win32)', () => {
const oldStat = await FsProvider.instance.stat(testFile);
await new Promise(resolve => {
setTimeout(async () => {
await ModLinker.link(Profile.getActiveProfile(), GameManager.defaultGame);
await ModLinker.link(Profile.getActiveAsImmutableProfile(), GameManager.defaultGame);
expect(await FsProvider.instance.exists(path.join(settings.getContext().gameSpecific.gameDirectory!, "test_file"))).toBeTruthy();
const newStat = await FsProvider.instance.stat(testFile);
expect(newStat.mtime).toEqual(oldStat.mtime);
Expand All @@ -77,7 +77,7 @@ const def = () => describe('ModLinker (win32)', () => {
await FsProvider.instance.writeFile(testFile, "modified");
await new Promise(resolve => {
setTimeout(async () => {
await ModLinker.link(Profile.getActiveProfile(), GameManager.defaultGame);
await ModLinker.link(Profile.getActiveAsImmutableProfile(), GameManager.defaultGame);
expect(await FsProvider.instance.exists(path.join(settings.getContext().gameSpecific.gameDirectory!, "test_file"))).toBeTruthy();
const newStat = await FsProvider.instance.stat(testFile);
expect(newStat.mtime).not.toEqual(oldStat.mtime);
Expand Down
Loading