Add all extension settings

Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
Sanjula Ganepola
2024-11-28 01:24:58 -05:00
parent 3f237f248c
commit 5d4299581f
15 changed files with 511 additions and 247 deletions

View File

@@ -1,5 +1,3 @@
import * as os from "os";
import * as path from "path";
import { ConfigurationTarget, workspace } from 'vscode';
import { Act } from './act';
@@ -11,8 +9,7 @@ export enum Platform {
export enum Section {
actCommand = 'actCommand',
dockerDesktopPath = 'dockerDesktopPath',
actionCachePath = 'actionCachePath'
dockerDesktopPath = 'dockerDesktopPath'
}
export namespace ConfigurationManager {
@@ -40,13 +37,6 @@ export namespace ConfigurationManager {
if (!actCommand) {
await ConfigurationManager.set(Section.actCommand, Act.defaultActCommand);
}
let actionCachePath = ConfigurationManager.get<string>(Section.actionCachePath);
if (!actionCachePath) {
actionCachePath = getCacheDirectory(['act']);
ConfigurationManager.set(Section.actionCachePath, actionCachePath);
}
}
export function getSearchTerm(section: Section): string {
@@ -60,10 +50,4 @@ export namespace ConfigurationManager {
export async function set(section: Section, value: any): Promise<void> {
return await workspace.getConfiguration(ConfigurationManager.group).update(section, value, ConfigurationTarget.Global);
}
function getCacheDirectory(paths: string[]) {
const userHomeDir = os.homedir();
const cacheHomeDir = process.env.XDG_CACHE_HOME || path.join(userHomeDir, '.cache');
return path.join(cacheHomeDir, ...paths);
}
}