The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a Desktop/-spelled plugin folder publishes on macOS and Windows
kshitijk4poordf98f3d8b085
diff --git a/apps/desktop/electron/desktop-plugins-root.test.ts b/apps/desktop/electron/desktop-plugins-root.test.tsindex 97f04a84259..db4a1a6d2b8 100644--- a/apps/desktop/electron/desktop-plugins-root.test.ts+++ b/apps/desktop/electron/desktop-plugins-root.test.ts@@ -467,6 +467,34 @@ describe('desktop tree publication', () => {expect(fs.existsSync(path.join(appRoot, 'media'))).toBe(false)})+ it.skipIf(process.platform === 'win32')(+ 'publishes a desktop folder whose on-disk name differs only in case',+ async () => {+ // macOS and Windows find `desktop/plugin.js` in a folder named `Desktop/`, and their realpath+ // returns the on-disk spelling. Stand that in on any filesystem: realpath answers `Desktop`.+ const home = makeHome()+ const appRoot = path.join(home, 'desktop-plugins')+ const pkg = path.join(home, 'plugins', 'media')+ write(path.join(pkg, 'desktop', 'plugin.js'), 'export default {}')+ write(path.join(pkg, 'Desktop', 'plugin.js'), 'export default {}')+ const realpath = fs.promises.realpath++ const spy = vi+ .spyOn(fs.promises, 'realpath')+ .mockImplementation(async p =>+ realpath(String(p) === path.join(pkg, 'desktop') ? path.join(pkg, 'Desktop') : p)+ )++ try {+ expect(await materializeDesktopHalf(pkg, appRoot)).toBe(path.join(appRoot, 'media'))+ } finally {+ spy.mockRestore()+ }++ expect(fs.readFileSync(path.join(appRoot, 'media', 'plugin.js'), 'utf8')).toBe('export default {}')+ }+ )+it.skipIf(process.platform === 'win32')('still publishes a development checkout the user linked in, links inside it included',async () => {diff --git a/apps/desktop/electron/desktop-plugins-root.ts b/apps/desktop/electron/desktop-plugins-root.tsindex 0a77928e17a..d4283c11d5c 100644--- a/apps/desktop/electron/desktop-plugins-root.ts+++ b/apps/desktop/electron/desktop-plugins-root.ts@@ -385,10 +385,16 @@ async function assertPlainDesktopTree(sourceDir: string,filter: (src: string) => boolean = () => true): Promise<void> {- const realRoot = await fs.promises.realpath(root)+ // Each folder from `root` down to `sourceDir` must be a real folder. Checked per folder, not by+ // comparing realpaths: a case-insensitive filesystem resolves `desktop` to an on-disk `Desktop`.+ let walked = root- if ((await fs.promises.realpath(sourceDir)) !== path.join(realRoot, path.relative(root, sourceDir))) {- throw new Error('The desktop plugin folder is a symbolic link; it is not installed.')+ for (const part of path.relative(root, sourceDir).split(path.sep).filter(Boolean)) {+ walked = path.join(walked, part)++ if ((await fs.promises.lstat(walked)).isSymbolicLink()) {+ throw new Error('The desktop plugin folder is a symbolic link; it is not installed.')+ }}let total = 0