( directory: string, settings: string, overwriteSettings: boolean )
| 144 | } |
| 145 | |
| 146 | async function writeToolchainsFileToDisk( |
| 147 | directory: string, |
| 148 | settings: string, |
| 149 | overwriteSettings: boolean |
| 150 | ) { |
| 151 | const location = path.join(directory, constants.MVN_TOOLCHAINS_FILE); |
| 152 | const settingsExists = fs.existsSync(location); |
| 153 | if (settingsExists && overwriteSettings) { |
| 154 | core.info(`Overwriting existing file ${location}`); |
| 155 | } else if (!settingsExists) { |
| 156 | core.info(`Writing to ${location}`); |
| 157 | } else { |
| 158 | core.info( |
| 159 | `Skipping generation of ${location} because file already exists and overwriting is not enabled` |
| 160 | ); |
| 161 | return; |
| 162 | } |
| 163 | |
| 164 | return fs.writeFileSync(location, settings, { |
| 165 | encoding: 'utf-8', |
| 166 | flag: 'w' |
| 167 | }); |
| 168 | } |
no outgoing calls
no test coverage detected