1"use strict"; 2var __importDefault = (this && this.__importDefault) || function (mod) { 3 return (mod && mod.__esModule) ? mod : { "default": mod }; 4}; 5Object.defineProperty(exports, "__esModule", { value: true }); 6exports.appDataPath = void 0; 7/* 8Copyright 2023 The Sigstore Authors. 9 10Licensed under the Apache License, Version 2.0 (the "License"); 11you may not use this file except in compliance with the License. 12You may obtain a copy of the License at 13 14 http://www.apache.org/licenses/LICENSE-2.0 15 16Unless required by applicable law or agreed to in writing, software 17distributed under the License is distributed on an "AS IS" BASIS, 18WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19See the License for the specific language governing permissions and 20limitations under the License. 21*/ 22const os_1 = __importDefault(require("os")); 23const path_1 = __importDefault(require("path")); 24function appDataPath(name) { 25 const homedir = os_1.default.homedir(); 26 switch (process.platform) { 27 /* istanbul ignore next */ 28 case 'darwin': { 29 const appSupport = path_1.default.join(homedir, 'Library', 'Application Support'); 30 return path_1.default.join(appSupport, name); 31 } 32 /* istanbul ignore next */ 33 case 'win32': { 34 const localAppData = process.env.LOCALAPPDATA || path_1.default.join(homedir, 'AppData', 'Local'); 35 return path_1.default.join(localAppData, name, 'Data'); 36 } 37 /* istanbul ignore next */ 38 default: { 39 const localData = process.env.XDG_DATA_HOME || path_1.default.join(homedir, '.local', 'share'); 40 return path_1.default.join(localData, name); 41 } 42 } 43} 44exports.appDataPath = appDataPath; 45