Skip to content

Commit 8348e12

Browse files
committed
fix: respect custom storage path for global custom modes
- Update ensureSettingsDirectoryExists() to use getSettingsDirectoryPath() - This ensures custom storage path setting is honored for global modes - Update createModeInstructions() to show correct path in help text - Update migrateSettings() to use custom storage path for migrations Fixes #8122
1 parent 87b45de commit 8348e12

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/core/prompts/instructions/create-mode.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import * as path from "path"
22
import * as vscode from "vscode"
33

44
import { GlobalFileNames } from "../../../shared/globalFileNames"
5+
import { getSettingsDirectoryPath } from "../../../utils/storage"
56

67
export async function createModeInstructions(context: vscode.ExtensionContext | undefined): Promise<string> {
78
if (!context) throw new Error("Missing VSCode Extension Context")
89

9-
const settingsDir = path.join(context.globalStorageUri.fsPath, "settings")
10+
// Use getSettingsDirectoryPath to honor custom storage path setting
11+
const settingsDir = await getSettingsDirectoryPath(context.globalStorageUri.fsPath)
1012
const customModesPath = path.join(settingsDir, GlobalFileNames.customModes)
1113

1214
return `

src/utils/globalContext.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { mkdir } from "fs/promises"
2-
import { join } from "path"
31
import { ExtensionContext } from "vscode"
2+
import { getSettingsDirectoryPath } from "./storage"
43

54
export async function getGlobalFsPath(context: ExtensionContext): Promise<string> {
65
return context.globalStorageUri.fsPath
76
}
87

98
export async function ensureSettingsDirectoryExists(context: ExtensionContext): Promise<string> {
10-
const settingsDir = join(context.globalStorageUri.fsPath, "settings")
11-
await mkdir(settingsDir, { recursive: true })
9+
// Use getSettingsDirectoryPath to honor custom storage path setting
10+
const settingsDir = await getSettingsDirectoryPath(context.globalStorageUri.fsPath)
11+
// getSettingsDirectoryPath already creates the directory, so no need to call mkdir
1212
return settingsDir
1313
}

src/utils/migrateSettings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from "path"
33
import * as fs from "fs/promises"
44
import { fileExistsAtPath } from "./fs"
55
import { GlobalFileNames } from "../shared/globalFileNames"
6+
import { getSettingsDirectoryPath } from "./storage"
67
import * as yaml from "yaml"
78

89
const deprecatedCustomModesJSONFilename = "custom_modes.json"
@@ -26,7 +27,8 @@ export async function migrateSettings(
2627
]
2728

2829
try {
29-
const settingsDir = path.join(context.globalStorageUri.fsPath, "settings")
30+
// Use getSettingsDirectoryPath to honor custom storage path setting
31+
const settingsDir = await getSettingsDirectoryPath(context.globalStorageUri.fsPath)
3032

3133
// Check if settings directory exists first
3234
if (!(await fileExistsAtPath(settingsDir))) {

0 commit comments

Comments
 (0)