mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 04:00:36 +00:00
refactor(settings): sequential settings migration
This commit is contained in:
parent
ac5a0c68e5
commit
ae8c0d3d4e
18 changed files with 3527 additions and 944 deletions
|
|
@ -7,7 +7,7 @@
|
|||
import * as path from 'node:path';
|
||||
import * as os from 'node:os';
|
||||
import * as fs from 'node:fs';
|
||||
import { getProjectHash } from '../utils/paths.js';
|
||||
import { getProjectHash, sanitizeCwd } from '../utils/paths.js';
|
||||
|
||||
export const QWEN_DIR = '.qwen';
|
||||
export const GOOGLE_ACCOUNTS_FILENAME = 'google_accounts.json';
|
||||
|
|
@ -82,7 +82,7 @@ export class Storage {
|
|||
}
|
||||
|
||||
getProjectDir(): string {
|
||||
const projectId = this.sanitizeCwd(this.getProjectRoot());
|
||||
const projectId = sanitizeCwd(this.getProjectRoot());
|
||||
const projectsDir = path.join(Storage.getGlobalQwenDir(), PROJECT_DIR_NAME);
|
||||
return path.join(projectsDir, projectId);
|
||||
}
|
||||
|
|
@ -140,10 +140,4 @@ export class Storage {
|
|||
getHistoryFilePath(): string {
|
||||
return path.join(this.getProjectTempDir(), 'shell_history');
|
||||
}
|
||||
|
||||
private sanitizeCwd(cwd: string): string {
|
||||
// On Windows, normalize to lowercase for case-insensitive matching
|
||||
const normalizedCwd = os.platform() === 'win32' ? cwd.toLowerCase() : cwd;
|
||||
return normalizedCwd.replace(/[^a-zA-Z0-9]/g, '-');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue