mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
khdslfjyufe
This commit is contained in:
@@ -6,6 +6,8 @@ const path = require('path');
|
||||
|
||||
const CANONICAL_DATA_DIR = path.resolve(__dirname, '..', '..', 'data');
|
||||
const LEGACY_DATA_DIR = path.resolve(__dirname, '..', 'data');
|
||||
const CANONICAL_ROVER_SNAPSHOT_DIR = path.join(CANONICAL_DATA_DIR, 'rover-snapshots');
|
||||
const LEGACY_ROVER_SNAPSHOT_DIR = path.join(LEGACY_DATA_DIR, 'rover-snapshots');
|
||||
|
||||
function pathExists(target) {
|
||||
try {
|
||||
@@ -35,7 +37,16 @@ function resolveDataPath(fileName) {
|
||||
return canonicalPath;
|
||||
}
|
||||
|
||||
function resolveRoverSnapshotDir() {
|
||||
const configured = String(process.env.ROVER_SNAPSHOT_DIR || '').trim();
|
||||
if (configured) return path.resolve(configured);
|
||||
if (pathExists(CANONICAL_ROVER_SNAPSHOT_DIR)) return CANONICAL_ROVER_SNAPSHOT_DIR;
|
||||
if (pathExists(LEGACY_ROVER_SNAPSHOT_DIR)) return LEGACY_ROVER_SNAPSHOT_DIR;
|
||||
return '/var/lib/rover-snapshots';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
resolveDataDir,
|
||||
resolveDataPath,
|
||||
resolveRoverSnapshotDir,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user