mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 02:01:29 +00:00
coding-agent: fix macOS screenshot filenames with unicode spaces (#181)
This commit is contained in:
parent
5c0a84b2d8
commit
9a7bbb2839
9 changed files with 70 additions and 108 deletions
|
|
@ -44,17 +44,21 @@ export interface LoadHooksResult {
|
|||
errors: Array<{ path: string; error: string }>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand path with ~ support.
|
||||
*/
|
||||
const UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
||||
|
||||
function normalizeUnicodeSpaces(str: string): string {
|
||||
return str.replace(UNICODE_SPACES, " ");
|
||||
}
|
||||
|
||||
function expandPath(p: string): string {
|
||||
if (p.startsWith("~/")) {
|
||||
return path.join(os.homedir(), p.slice(2));
|
||||
const normalized = normalizeUnicodeSpaces(p);
|
||||
if (normalized.startsWith("~/")) {
|
||||
return path.join(os.homedir(), normalized.slice(2));
|
||||
}
|
||||
if (p.startsWith("~")) {
|
||||
return path.join(os.homedir(), p.slice(1));
|
||||
if (normalized.startsWith("~")) {
|
||||
return path.join(os.homedir(), normalized.slice(1));
|
||||
}
|
||||
return p;
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue