mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-02 01:51:38 +00:00
045ee573a0
* Update * Updates * More refactoringzzz * Bindoo * Loadz of typescripting * Logga * Updates * Updates * Updates * Updates * cleanup * updates * Fix coverage * Fixes * Updates * Updates
30 lines
593 B
TypeScript
30 lines
593 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 __testingOnly_reload(): void {
|
|
load();
|
|
}
|
|
|
|
export default {joinPath, getPath, __testingOnly_reload};
|