Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Delete GOG manifest if present before install #4318

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 11 additions & 4 deletions src/backend/downloadmanager/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { DMStatus, InstallParams, Runner } from 'common/types'
import i18next from 'i18next'
import { notify, showDialogBoxModalAuto } from '../dialog/dialog'
import { isOnline } from '../online_monitor'
import { fixesPath, isWindows } from 'backend/constants'
import path from 'path'
import { existsSync, mkdirSync } from 'graceful-fs'
import { fixesPath, gogdlConfigPath, isWindows } from 'backend/constants'
import pathModule from 'path'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to rename this to pathModule cause path already exists inside the installQueueElement function defined as a variable out of the install params

import { existsSync, mkdirSync, rmSync } from 'graceful-fs'
import { storeMap } from 'common/utils'

async function installQueueElement(params: InstallParams): Promise<{
Expand Down Expand Up @@ -54,6 +54,13 @@ async function installQueueElement(params: InstallParams): Promise<{
}
}

if (runner === 'gog') {
// Sometimes, a game manifest file already exists and that makes the installation
// end as soon as it's started. We have to delete the file to prevent that issue.
const manifestPath = pathModule.join(gogdlConfigPath, 'manifests', appName)
if (existsSync(manifestPath)) rmSync(manifestPath)
}

sendGameStatusUpdate({
appName,
runner,
Expand Down Expand Up @@ -181,7 +188,7 @@ async function updateQueueElement(params: InstallParams): Promise<{

async function downloadFixesFor(appName: string, runner: Runner) {
const url = `https://raw.githubusercontent.com/Heroic-Games-Launcher/known-fixes/main/${storeMap[runner]}/${appName}-${storeMap[runner]}.json`
const dest = path.join(fixesPath, `${appName}-${storeMap[runner]}.json`)
const dest = pathModule.join(fixesPath, `${appName}-${storeMap[runner]}.json`)
if (!existsSync(fixesPath)) {
mkdirSync(fixesPath, { recursive: true })
}
Expand Down
Loading