mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-01 17:41:37 +00:00
09383877b0
* Update dependencies * Fix lint Co-authored-by: Koenkk <Koenkk@users.noreply.github.com> Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
30 lines
587 B
TypeScript
30 lines
587 B
TypeScript
import path from 'path';
|
|
|
|
let dataPath: string = null;
|
|
|
|
function load(): void {
|
|
if (process.env.ZIGBEE2MQTT_DATA) {
|
|
dataPath = process.env.ZIGBEE2MQTT_DATA;
|
|
} else {
|
|
dataPath = path.join(__dirname, '..', '..', 'data');
|
|
dataPath = path.normalize(dataPath);
|
|
}
|
|
}
|
|
|
|
load();
|
|
|
|
function joinPath(file: string): string {
|
|
return path.join(dataPath, file);
|
|
}
|
|
|
|
function getPath(): string {
|
|
return dataPath;
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
|
function testingOnlyReload(): void {
|
|
load();
|
|
}
|
|
|
|
export default {joinPath, getPath, testingOnlyReload};
|