File tree Expand file tree Collapse file tree
src/UniqueFileGenerator.Console Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11namespace UniqueFileGenerator.Console
22
33open System
4- open System.Text
54
65module StringGeneration =
76 let private charBank =
@@ -18,13 +17,14 @@ module StringGeneration =
1817 let generateMultiple itemLength count : string array =
1918 Array.init count ( fun _ -> generateSingle itemLength)
2019
21- let toFileName prefix extension baseName : string =
22- let ensureValidExtension ext =
23- if String.IsNullOrWhiteSpace ext then String.Empty
24- elif ext.StartsWith '.' then ext.Trim()
25- else $" .%s {ext.Trim()}"
20+ let toFileName ( prefix : string ) ( extension : string ) ( baseName : string ) : string =
21+ let safeExtension =
22+ match extension.Trim() with
23+ | ext when String.IsNullOrWhiteSpace ext -> String.Empty
24+ | ext when ext.StartsWith '.' -> ext
25+ | ext -> $" .%s {ext}"
2626
27- $" %s {prefix}%s {baseName}%s {ensureValidExtension extension }"
27+ $" %s {prefix}%s {baseName}%s {safeExtension }"
2828
2929 let generateFileContent sizeInBytes fallback : string =
3030 sizeInBytes
You can’t perform that action at this time.
0 commit comments