From: Siwar GAROUACHI Date: Thu, 4 Aug 2022 06:42:38 +0000 (+0200) Subject: support relative paths for charging station templates X-Git-Tag: v1.1.65~21^2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ee5f26a24666fb2cef25a4beb8fee27a1b4fcd94;p=e-mobility-charging-stations-simulator.git support relative paths for charging station templates --- diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index b5e90bd8..23307f4c 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -194,7 +194,7 @@ export default class Bootstrap { path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'), 'assets', 'station-templates', - path.basename(stationTemplateUrl.file) + stationTemplateUrl.file ), }; await this.workerImplementation.addElement(workerData); diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 8c20993c..d7dcdcee 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -3,7 +3,7 @@ import crypto from 'crypto'; import fs from 'fs'; import path from 'path'; -import { URL, fileURLToPath } from 'url'; +import { URL } from 'url'; import { parentPort } from 'worker_threads'; import WebSocket, { Data, RawData } from 'ws'; @@ -861,9 +861,7 @@ export default class ChargingStation { this.hashId = ChargingStationUtils.getHashId(this.index, this.getTemplateFromFile()); logger.info(`${this.logPrefix()} Charging station hashId '${this.hashId}'`); this.configurationFile = path.join( - path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'), - 'assets', - 'configurations', + path.dirname(this.templateFile.replace('station-templates', 'configurations')), this.hashId + '.json' ); this.stationInfo = this.getStationInfo();