(dirPath, prefix)
| 1069 | } |
| 1070 | |
| 1071 | function createUniqueImageName(dirPath, prefix) { |
| 1072 | const stamp = formatTimestamp(new Date()) |
| 1073 | let fileName = `${prefix}${stamp}${PASTE_IMAGE_EXT}` |
| 1074 | let filePath = path.join(dirPath, fileName) |
| 1075 | let counter = 1 |
| 1076 | while (fs.existsSync(filePath)) { |
| 1077 | fileName = `${prefix}${stamp}-${counter}${PASTE_IMAGE_EXT}` |
| 1078 | filePath = path.join(dirPath, fileName) |
| 1079 | counter += 1 |
| 1080 | } |
| 1081 | return { fileName, filePath } |
| 1082 | } |
| 1083 | |
| 1084 | function isGitRepoRoot(cwd) { |
| 1085 | const gitDir = path.join(cwd, '.git') |
no test coverage detected