mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
handle lower case am/pm in macos screenshot names (#3194)
This commit is contained in:
parent
a3666344f4
commit
d22c120b82
2 changed files with 16 additions and 1 deletions
|
|
@ -9,7 +9,7 @@ function normalizeUnicodeSpaces(str: string): string {
|
|||
}
|
||||
|
||||
function tryMacOSScreenshotPath(filePath: string): string {
|
||||
return filePath.replace(/ (AM|PM)\./g, `${NARROW_NO_BREAK_SPACE}$1.`);
|
||||
return filePath.replace(/ (AM|PM)\./gi, `${NARROW_NO_BREAK_SPACE}$1.`);
|
||||
}
|
||||
|
||||
function tryNFDVariant(filePath: string): string {
|
||||
|
|
|
|||
|
|
@ -143,5 +143,20 @@ describe("path-utils", () => {
|
|||
// This works because tryMacOSScreenshotPath() handles this case
|
||||
expect(result).toBe(join(tempDir, macosName));
|
||||
});
|
||||
|
||||
it("should handle macOS screenshot lowercase am/pm variant (en_AU locale)", () => {
|
||||
// Some locales like en_AU use lowercase am/pm in screenshot names
|
||||
const macosName = "Screenshot 2024-01-01 at 10.00.00\u202Fam.png"; // U+202F + lowercase
|
||||
const userName = "Screenshot 2024-01-01 at 10.00.00 am.png"; // regular space + lowercase
|
||||
|
||||
// Create file with macOS-style name
|
||||
writeFileSync(join(tempDir, macosName), "content");
|
||||
|
||||
// User provides regular space path
|
||||
const result = resolveReadPath(userName, tempDir);
|
||||
|
||||
// This works because tryMacOSScreenshotPath() uses case-insensitive matching
|
||||
expect(result).toBe(join(tempDir, macosName));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue