Skip to content

Commit c16f064

Browse files
committed
Replaced more usages of process.platform which should use appWindow impl
1 parent fec13a7 commit c16f064

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {computed} from "vue";
22
import path from "../../providers/node/path/path";
33
import PathResolver from "../../r2mm/manager/PathResolver";
4+
import appWindow from '../../providers/node/app/app_window';
45

5-
export const ComputedWrapperLaunchArguments = computed(() => `"${path.join(PathResolver.MOD_ROOT, process.platform === 'darwin' ? 'macos_proxy' : 'linux_wrapper.sh')}" %command%`);
6+
export const ComputedWrapperLaunchArguments = computed(() => `"${path.join(PathResolver.MOD_ROOT, appWindow.getPlatform() === 'darwin' ? 'macos_proxy' : 'linux_wrapper.sh')}" %command%`);

src/pages/Help.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ import {State} from '../store';
110110
import {getDeterminedLaunchType} from "../utils/LaunchUtils";
111111
import {ComputedWrapperLaunchArguments} from "../components/computed/WrapperArguments";
112112
import {getLaunchType, LaunchType} from "../model/real_enums/launch/LaunchType";
113+
import appWindow from '../providers/node/app/app_window';
113114
114115
const store = getStore<State>();
115116
@@ -122,7 +123,7 @@ const launchArgs = ref("");
122123
watchEffect(async () => {
123124
const loaderArgs = doorstopTarget.value;
124125
const prerequisiteText = ComputedWrapperLaunchArguments.value;
125-
if (process.platform === 'win32') {
126+
if (appWindow.getPlatform() === 'win32') {
126127
launchArgs.value = loaderArgs;
127128
return;
128129
}

src/pages/LinuxNativeGameSetup.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ import { State } from '../store';
2424
import VueRouter, {useRouter} from 'vue-router';
2525
import {ComputedWrapperLaunchArguments} from "../components/computed/WrapperArguments";
2626
import InteractionProviderImpl from "../r2mm/system/InteractionProviderImpl";
27+
import appWindow from '../providers/node/app/app_window';
2728
2829
const store = getStore<State>();
2930
let router = useRouter();
3031
3132
const activeGame = computed(() => store.state.activeGame.displayName);
32-
const platformName = computed<string>(() => process.platform === 'darwin' ? 'macOS' : process.platform);
33+
const platformName = computed<string>(() => appWindow.getPlatform() === 'darwin' ? 'macOS' : appWindow.getPlatform());
3334
3435
function copy(){
3536
let range = document.createRange();

src/r2mm/launching/instructions/GameInstructionParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default class GameInstructionParser {
8282

8383
private static async bepInExRendererPreloaderPath(game: Game, profile: Profile): Promise<string | R2Error> {
8484
try {
85-
if (['linux'].includes(process.platform.toLowerCase())) {
85+
if (['linux'].includes(appWindow.getPlatform().toLowerCase())) {
8686
const isProton = await isProtonRequired(game);
8787
const corePath = await FsProvider.instance.realpath(profile.joinToProfilePath('BepInEx', 'core'));
8888
const preloaderPath = path.join(corePath,

src/r2mm/launching/instructions/instructions/loader/BepisLoaderGameInstructions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import FsProvider from '../../../../../providers/generic/file/FsProvider';
66
import { DynamicGameInstruction } from '../../DynamicGameInstruction';
77
import { GameInstanceType } from '../../../../../model/schema/ThunderstoreSchema';
88
import path from 'path';
9+
import appWindow from 'src/providers/node/app/app_window';
910

1011
export default class BepisLoaderGameInstructions extends GameInstructionGenerator {
1112

1213
public async generate(game: Game, profile: Profile): Promise<GameInstruction> {
1314
let extraArguments = "";
14-
if (["linux", "darwin"].includes(process.platform.toLowerCase())) {
15+
if (["linux", "darwin"].includes(appWindow.getPlatform().toLowerCase())) {
1516
extraArguments += ` --r2profile "${DynamicGameInstruction.PROFILE_NAME}"`;
1617
if (game.instanceType === GameInstanceType.SERVER) {
1718
extraArguments += ` --server`;

src/utils/LaunchUtils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import LinuxGameDirectoryResolver from '../r2mm/manager/linux/GameDirectoryResol
1111
import {LaunchType} from "../model/real_enums/launch/LaunchType";
1212
import path from "../providers/node/path/path";
1313
import PathResolver from "../r2mm/manager/PathResolver";
14+
import appWindow from '../providers/node/app/app_window';
1415

1516
export enum LaunchMode { VANILLA, MODDED };
1617

@@ -71,7 +72,7 @@ export const throwIfNoGameDir = async (game: Game): Promise<void> => {
7172
};
7273

7374
export async function isProtonRequired(activeGame: Game) {
74-
if (process.platform !== 'linux') {
75+
if (appWindow.getPlatform() !== 'linux') {
7576
return false;
7677
}
7778
return [Platform.STEAM, Platform.STEAM_DIRECT].includes(activeGame.activePlatform.storePlatform)
@@ -97,5 +98,5 @@ export async function areWrapperArgumentsProvided(game: Game): Promise<boolean>
9798
}
9899

99100
export async function getWrapperLaunchArgs(): Promise<string> {
100-
return `"${path.join(PathResolver.MOD_ROOT, process.platform === 'darwin' ? 'macos_proxy' : 'linux_wrapper.sh')}" %command%`;
101+
return `"${path.join(PathResolver.MOD_ROOT, appWindow.getPlatform() === 'darwin' ? 'macos_proxy' : 'linux_wrapper.sh')}" %command%`;
101102
}

0 commit comments

Comments
 (0)