gcal-commander
Version:
A command-line interface for Google Calendar operations
47 lines (46 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppPaths = void 0;
const node_os_1 = require("node:os");
const node_path_1 = require("node:path");
/**
* Centralized path management for gcal-commander application files
*/
class AppPaths {
static APP_DIR = AppPaths.getValidatedAppDir();
/**
* Get the application directory path
*/
static getAppDir() {
return this.APP_DIR;
}
/**
* Get the path to the application configuration file
*/
static getConfigPath() {
return (0, node_path_1.join)(this.APP_DIR, 'config.json');
}
/**
* Get the path to the Google OAuth credentials file
*/
static getCredentialsPath() {
return (0, node_path_1.join)(this.APP_DIR, 'credentials.json');
}
/**
* Get the path to the Google OAuth token file
*/
static getTokenPath() {
return (0, node_path_1.join)(this.APP_DIR, 'token.json');
}
/**
* Get and validate the application directory path
*/
static getValidatedAppDir() {
const home = (0, node_os_1.homedir)();
if (!home || typeof home !== 'string') {
throw new Error('Unable to determine home directory');
}
return (0, node_path_1.join)(home, '.gcal-commander');
}
}
exports.AppPaths = AppPaths;