Skip to content

Commit 5a69bc6

Browse files
committed
Use constructed path
1 parent 4031c13 commit 5a69bc6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/ext.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ export async function activate(context: flashpoint.ExtensionContext) {
2626
}
2727

2828
flashpoint.games.onWillUninstallGameData(async (gameData) => {
29-
const filePath: string = path.resolve(path.join(dataPacksPath, gameData.path));
30-
flashpoint.log.debug(`Unmounting Game Data: \"${gameData.path}\"`);
29+
const filename = getGameDataFilename(gameData);
30+
const filePath: string = path.resolve(path.join(dataPacksPath, filename));
31+
flashpoint.log.debug(`Unmounting Game Data: \"${filename}\"`);
3132
return unmountGame(filePath);
3233
});
3334

3435
flashpoint.games.onWillLaunchGame(async (gameLaunchInfo) => {
3536
if (gameLaunchInfo.activeData) {
3637
if (gameLaunchInfo.activeData.presentOnDisk) {
3738
// Data present, mount it now
39+
const filename = getGameDataFilename(gameLaunchInfo.activeData);
3840
flashpoint.log.debug("GameData present on disk, mounting...");
39-
const filePath: string = path.resolve(path.join(dataPacksPath, gameLaunchInfo.activeData.path));
41+
const filePath: string = path.resolve(path.join(dataPacksPath, filename));
4042
flashpoint.log.debug(`Mount parameters: \"${gameLaunchInfo.activeData.parameters}\"`);
4143
if (gameLaunchInfo.activeData.parameters?.startsWith("-extract")) {
4244
flashpoint.log.debug("AutoMount skipping, '-extract' registered.");
@@ -57,8 +59,9 @@ export async function activate(context: flashpoint.ExtensionContext) {
5759
const activeData = await flashpoint.gameData.findOne(addAppInfo.parentGame.activeDataId)
5860
if (activeData && activeData.presentOnDisk) {
5961
// Data present, mount it now
62+
const filename = getGameDataFilename(activeData);
6063
flashpoint.log.debug("GameData present on disk, mounting...");
61-
const filePath: string = path.resolve(path.join(dataPacksPath, activeData.path));
64+
const filePath: string = path.resolve(path.join(dataPacksPath, filename));
6265
flashpoint.log.debug(`Mount parameters: \"${activeData.parameters}\"`);
6366
if (activeData.parameters?.startsWith("-extract")) {
6467
flashpoint.log.debug("AutoMount skipping, '-extract' registered.");
@@ -76,3 +79,7 @@ export async function activate(context: flashpoint.ExtensionContext) {
7679
}
7780
});
7881
};
82+
83+
export function getGameDataFilename(data: flashpoint.GameData) {
84+
return `${data.gameId}-${(new Date(data.dateAdded)).getTime()}.zip`;
85+
}

0 commit comments

Comments
 (0)