mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
fix(hooks): correct cross-platform path handling in getProjectSettingsPath
Remove incorrect path separator conversion that caused directory creation issues on Linux/WSL platforms. The function was converting forward slashes to backslashes, which are treated as literal filename characters on Unix systems rather than path separators. Changes: - Remove manual path normalization in getProjectSettingsPath() - Rely on Node.js path.join() for cross-platform compatibility - Fix affects both hooks-routes.ts and mcp-routes.ts Impact: - Linux/WSL: Fixes incorrect directory creation - Windows: No behavior change, maintains correct functionality Fixes project-level hook settings being saved to wrong location when using Dashboard frontend on Linux/WSL systems.
This commit is contained in:
@@ -31,8 +31,8 @@ const GLOBAL_SETTINGS_PATH = join(homedir(), '.claude', 'settings.json');
|
||||
* @returns {string}
|
||||
*/
|
||||
function getProjectSettingsPath(projectPath) {
|
||||
const normalizedPath = projectPath.replace(/\//g, '\\').replace(/^\\([a-zA-Z])\\/, '$1:\\');
|
||||
return join(normalizedPath, '.claude', 'settings.json');
|
||||
// path.join automatically handles cross-platform path separators
|
||||
return join(projectPath, '.claude', 'settings.json');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1000,8 +1000,8 @@ function writeSettingsFile(filePath, settings) {
|
||||
* @returns {string}
|
||||
*/
|
||||
function getProjectSettingsPath(projectPath) {
|
||||
const normalizedPath = projectPath.replace(/\//g, '\\').replace(/^\\([a-zA-Z])\\/, '$1:\\');
|
||||
return join(normalizedPath, '.claude', 'settings.json');
|
||||
// path.join automatically handles cross-platform path separators
|
||||
return join(projectPath, '.claude', 'settings.json');
|
||||
}
|
||||
|
||||
// ========================================
|
||||
|
||||
Reference in New Issue
Block a user