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: 2 additions & 0 deletions public/locales/en/gamepage.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
},
"button": {
"add_to_favourites": "Add To Favourites",
"browse_files": "Browse Files",
"browse_wine_prefix": "Browse Wine Prefix",
"cancel": "Pause/Cancel",
"changelog": "Show Changelog",
"continue": "Continue Download",
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/screens/Game/GamePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export default React.memo(function GamePage(): JSX.Element | null {
}

const isMacNative = ['osx', 'Mac'].includes(installPlatform ?? '')
const isLinuxNative = installPlatform === 'linux'
const isLinuxNative = ['linux', 'Linux'].includes(installPlatform ?? '')

// create setting context functions
const contextValues: GameContextType = {
Expand Down
39 changes: 37 additions & 2 deletions src/frontend/screens/Game/GameSubMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './index.css'

import React, { useContext, useEffect, useState } from 'react'
import React, { useCallback, useContext, useEffect, useState } from 'react'

import { GameInfo, GameStatus, Runner } from 'common/types'

Expand Down Expand Up @@ -50,7 +50,7 @@ export default function GamesSubmenu({
showDialogModal,
setIsSettingsModalOpen
} = useContext(ContextProvider)
const { is } = useContext(GameContext)
const { is, gameSettings } = useContext(GameContext)
const isWin = platform === 'win32'
const isLinux = platform === 'linux'

Expand Down Expand Up @@ -233,6 +233,25 @@ export default function GamesSubmenu({
isInstalled &&
!isThirdPartyManaged

const hasWine =
!is.win && !is.native && gameSettings?.wineVersion.type !== 'crossover'

const onBrowseFiles = useCallback(() => {
const path = gameInfo.install.install_path || gameInfo.folder_name

if (path) {
window.api.openFolder(path)
}
}, [gameInfo])

const onBrowsePrefix = useCallback(() => {
const path = gameSettings?.winePrefix

if (path) {
window.api.openFolder(path)
}
}, [gameSettings])

return (
<>
<div className="gameTools subMenuContainer">
Expand Down Expand Up @@ -377,6 +396,22 @@ export default function GamesSubmenu({
{t('game.modify', 'Modify Installation')}
</button>
)}
{isInstalled && (
<button
onClick={async () => onBrowseFiles()}
className="link button is-text is-link"
>
{t('button.browse_files', 'Browse Files')}
</button>
)}
{hasWine && (
<button
onClick={async () => onBrowsePrefix()}
className="link button is-text is-link"
>
{t('button.browse_wine_prefix', 'Browse Wine Prefix')}
</button>
)}
</div>
</div>
{showModal && (
Expand Down
Loading