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

Function canCreateFileSymlink

__tests__/upgrade.test.ts:1080–1091  ·  view source on GitHub ↗

File symlinks need Developer Mode or admin rights on Windows.

()

Source from the content-addressed store, hash-verified

1078
1079/** File symlinks need Developer Mode or admin rights on Windows. */
1080function canCreateFileSymlink(): boolean {
1081 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-symlink-probe-'));
1082 try {
1083 fs.writeFileSync(path.join(dir, 'target'), '');
1084 fs.symlinkSync(path.join(dir, 'target'), path.join(dir, 'link'), 'file');
1085 return true;
1086 } catch {
1087 return false;
1088 } finally {
1089 fs.rmSync(dir, { recursive: true, force: true });
1090 }
1091}
1092const FILE_SYMLINKS = canCreateFileSymlink();
1093
1094describe.skipIf(!FILE_SYMLINKS)(`post-upgrade refresh with a link it can't write through (#2721)${FILE_SYMLINKS ? '' : ' — skipped: creating a file symlink needs Developer Mode or admin rights on Windows'}`, () => {

Callers 1

upgrade.test.tsFile · 0.70

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected