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

Function canCreateFileSymlink

__tests__/upgrade.test.ts:1081–1092  ·  view source on GitHub ↗

File symlinks need Developer Mode or admin rights on Windows.

()

Source from the content-addressed store, hash-verified

1079
1080/** File symlinks need Developer Mode or admin rights on Windows. */
1081function canCreateFileSymlink(): boolean {
1082 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-symlink-probe-'));
1083 try {
1084 fs.writeFileSync(path.join(dir, 'target'), '');
1085 fs.symlinkSync(path.join(dir, 'target'), path.join(dir, 'link'), 'file');
1086 return true;
1087 } catch {
1088 return false;
1089 } finally {
1090 fs.rmSync(dir, { recursive: true, force: true });
1091 }
1092}
1093const FILE_SYMLINKS = canCreateFileSymlink();
1094
1095describe.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