MCPcopy Create free account
hub / github.com/codeHappyDananx/SpecWave / ensureGitignoreLine

Function ensureGitignoreLine

electron/main.js:1093–1110  ·  view source on GitHub ↗
(cwd, pattern)

Source from the content-addressed store, hash-verified

1091}
1092
1093function ensureGitignoreLine(cwd, pattern) {
1094 const gitignorePath = path.join(cwd, '.gitignore')
1095 let content = ''
1096 try {
1097 if (fs.existsSync(gitignorePath)) {
1098 content = fs.readFileSync(gitignorePath, 'utf8')
1099 }
1100 } catch {
1101 return
1102 }
1103 if (content.includes(pattern)) return
1104 const next = content.length === 0 || content.endsWith('\n') ? content : `${content}\n`
1105 try {
1106 fs.writeFileSync(gitignorePath, `${next}${pattern}\n`)
1107 } catch {
1108 // ignore write errors
1109 }
1110}
1111
1112function ensurePasteDirectory(cwd) {
1113 const dirPath = path.join(cwd, PASTE_IMAGE_DIR)

Callers 1

saveClipboardImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected