Merge pull request #42 from rhyme227/fix/cross-platform-path-handling

fix(hooks): correct cross-platform path handling in getProjectSettingsPath
This commit is contained in:
catlog22
2025-12-23 18:49:35 +08:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -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');
}
/**

View File

@@ -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');
}
// ========================================