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

Function canCreateFileSymlink

__tests__/installer-targets.test.ts:2398–2409  ·  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

2396 * with the reason in their name, rather than passing without running.
2397 */
2398function canCreateFileSymlink(): boolean {
2399 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-symlink-probe-'));
2400 try {
2401 fs.writeFileSync(path.join(dir, 'target'), '');
2402 fs.symlinkSync(path.join(dir, 'target'), path.join(dir, 'link'), 'file');
2403 return true;
2404 } catch {
2405 return false;
2406 } finally {
2407 fs.rmSync(dir, { recursive: true, force: true });
2408 }
2409}
2410const FILE_SYMLINKS = canCreateFileSymlink();
2411const NO_FILE_SYMLINKS = ' — skipped: creating a file symlink needs Developer Mode or admin rights on Windows';
2412

Callers 1

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected