A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
TypeScript amazon-primeelectronepic-games-launcherepic-games-storeepic-storegaminggoggog-galaxyheroic-games-launcherlinuxplay-gamesprotonsteamwine
import type { GameSettings, Runner } from 'common/types'
import type { GOGCloudSavesLocation } from 'common/types/gog'
export const shouldPreserveSavePaths = (
settings: Pick<GameSettings, 'savePathIsCustom' | 'savesPathFingerprint'>,
fingerprint: string
): boolean =>
Boolean(
settings.savePathIsCustom && settings.savesPathFingerprint !== fingerprint
)
export const getSavePathMigrations = (
runner: Runner,
settings: GameSettings,
newPaths: string | GOGCloudSavesLocation[]
): Array<[string, string]> => {
const migrations: Array<[string, string]> = []
if (runner === 'gog') {
for (const newLocation of newPaths as GOGCloudSavesLocation[]) {
const oldLocation = (settings.gogSaves ?? []).find(
({ name }) => name === newLocation.name
)
if (
!oldLocation?.location ||
oldLocation.location === newLocation.location
) {
continue
}
migrations.push([oldLocation.location, newLocation.location])
}
return migrations
}
if (
typeof newPaths === 'string' &&
settings.savesPath &&
settings.savesPath !== newPaths
) {
migrations.push([settings.savesPath, newPaths])
}
return migrations
}