MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / canCreateFileSymlink

Function canCreateFileSymlink

__tests__/installer-targets.test.ts:2565–2576  ·  view source on GitHub ↗

* Whether this machine can create a file symlink. On Windows that needs * Developer Mode or admin rights; where it can't, the link tests are skipped, * with the reason in their name, rather than passing without running.

()

Source from the content-addressed store, hash-verified

2563 * with the reason in their name, rather than passing without running.
2564 */
2565function canCreateFileSymlink(): boolean {
2566 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-symlink-probe-'));
2567 try {
2568 fs.writeFileSync(path.join(dir, 'target'), '');
2569 fs.symlinkSync(path.join(dir, 'target'), path.join(dir, 'link'), 'file');
2570 return true;
2571 } catch {
2572 return false;
2573 } finally {
2574 fs.rmSync(dir, { recursive: true, force: true });
2575 }
2576}
2577const FILE_SYMLINKS = canCreateFileSymlink();
2578const NO_FILE_SYMLINKS = ' — skipped: creating a file symlink needs Developer Mode or admin rights on Windows';
2579

Callers 1

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected