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

Function atomicWriteFileSync

src/installer/targets/shared.ts:117–129  ·  view source on GitHub ↗
(filePath: string, content: string)

Source from the content-addressed store, hash-verified

115 * changes.
116 */
117export function atomicWriteFileSync(filePath: string, content: string): void {
118 if (!isSymbolicLink(filePath)) {
119 writeThenRename(filePath, content, true);
120 return;
121 }
122 let target = filePath;
123 try {
124 target = linkTarget(filePath);
125 writeThenRename(target, content, false);
126 } catch (err) {
127 throw linkWriteError(filePath, target, err);
128 }
129}
130
131function writeThenRename(filePath: string, content: string, createFolder: boolean): void {
132 const dir = path.dirname(filePath);

Callers 15

upsertCodegraphServerFunction · 0.90
removeCodegraphServerFunction · 0.90
uninstallMethod · 0.90
writeHermesConfigFunction · 0.90
writeMcpEntryFunction · 0.90
removeMcpEntryAtFunction · 0.90
writePatchFunction · 0.90
removeFromPatchFunction · 0.90
writeMcpEntryFunction · 0.90
removeMcpEntryFunction · 0.90
writeMcpEntryFunction · 0.90
removeMcpEntryFunction · 0.90

Calls 4

isSymbolicLinkFunction · 0.85
writeThenRenameFunction · 0.85
linkTargetFunction · 0.85
linkWriteErrorFunction · 0.85

Tested by

no test coverage detected