From ee5f26a24666fb2cef25a4beb8fee27a1b4fcd94 Mon Sep 17 00:00:00 2001 From: Siwar GAROUACHI Date: Thu, 4 Aug 2022 08:42:38 +0200 Subject: [PATCH] support relative paths for charging station templates --- src/charging-station/Bootstrap.ts | 2 +- src/charging-station/ChargingStation.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) 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(); -- 2.34.1