Storage class is now OOP

This commit is contained in:
2025-01-01 21:34:23 +01:00
parent 04e081c31a
commit 5982422e04
15 changed files with 109 additions and 72 deletions

View File

@ -4,7 +4,7 @@ import { Server } from 'socket.io'
import { gameLogger, gameMasterLogger } from '#application/logger'
import prisma from '#application/prisma'
import { getPublicPath } from '#application/storage'
import Storage from '#application/storage'
import { TSocket } from '#application/types'
import characterRepository from '#repositories/characterRepository'
@ -38,10 +38,10 @@ export default class ObjectRemoveEvent {
})
// get root path
const public_folder = getPublicPath('objects')
const public_folder = Storage.getPublicPath('objects')
// remove the tile from the disk
const finalFilePath = getPublicPath('objects', data.object + '.png')
const finalFilePath = Storage.getPublicPath('objects', data.object + '.png')
fs.unlink(finalFilePath, (err) => {
if (err) {
gameMasterLogger.error(`Error deleting object ${data.object}: ${err.message}`)