Skip to content

Commit 3780d76

Browse files
committed
[ISSUE#21]: file creating added
Signed-off-by: ashish <[email protected]> Signed-off-by: ashish <[email protected]>
1 parent c7fb2a1 commit 3780d76

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/utilities/utilities.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ export default class Utilities {
3939
}
4040

4141
public static writeStringToFile(thisRef: any, filePath: string, string: string) {
42-
if (!fs.existsSync(filePath)) {
43-
Logger.error(thisRef, `Could not find file: ${filePath}`) // this will output error and exit command
44-
} else {
45-
fs.writeFileSync(filePath, string)
46-
Logger.success(thisRef, `Hash written to file: ${filePath}`) // this will output error and exit command
47-
}
42+
if (!fs.existsSync(filePath))
43+
Logger.info(thisRef, `Could not find file: ${filePath}, creating new one`) // this will output error and exit command
44+
else
45+
Logger.info(thisRef, `File already exists: ${filePath}, overriding content`) // this will output error and exit command
46+
47+
fs.writeFileSync(filePath, string)
48+
Logger.success(thisRef, `Hash written to file: ${filePath}`) // this will output error and exit command
49+
4850
}
4951
}

0 commit comments

Comments
 (0)