Skip to content

Commit

Permalink
Merge pull request #23 from alex-sandr111/Fixed-path-to-save-files-on…
Browse files Browse the repository at this point in the history
…-macos

Fixed path to save files on macos
  • Loading branch information
FINDarkside authored Dec 2, 2024
2 parents f229541 + 21e89ba commit ef7b573
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { reactive, toRaw } from 'vue';
import tldParser, { slotParser } from './tldSave/tldParser';
import parser from './tldSave/tldParser';
import async, { forEach } from 'async';
const os = require('os');
import path from 'path';
import GameRegion from 'src/tldSave/types/generated/enums/GameRegion';
import availableLocations from 'src/tldSave/availableLocations';
Expand Down Expand Up @@ -107,13 +108,15 @@ const store = {
const saveFileRegex =
/^(ep[0-9])?(sandbox|challenge|story|relentless)[0-9]+$/;

if (!process.env.LOCALAPPDATA) throw new Error('LOCALAPPDATA is not set');
let saveFolder;

if (os.platform() === 'darwin') {
saveFolder = path.join(os.homedir(), '.local', 'share', 'Hinterland', 'TheLongDark');
} else {
if (!process.env.LOCALAPPDATA) throw new Error('LOCALAPPDATA is not set');
saveFolder = path.join(process.env.LOCALAPPDATA, 'Hinterland', 'TheLongDark');
}

const saveFolder = path.join(
process.env.LOCALAPPDATA,
'Hinterland',
'TheLongDark'
);
const files = (await readdir(saveFolder)).filter((file) =>
saveFileRegex.test(file)
);
Expand Down

0 comments on commit ef7b573

Please sign in to comment.