File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -309,6 +309,10 @@ type ILVersionInfo =
309309 new ( major , minor , build , revision ) =
310310 { Major = major; Minor = minor; Build = build; Revision = revision }
311311
312+ /// For debugging
313+ override x.ToString () = sprintf " ILVersionInfo: %u %u %u %u " ( x.Major) ( x.Minor) ( x.Build) ( x.Revision)
314+
315+
312316type Locale = string
313317
314318[<StructuralEquality; StructuralComparison>]
Original file line number Diff line number Diff line change @@ -837,11 +837,24 @@ module MainModuleBuilder =
837837 v
838838
839839 let productVersionToILVersionInfo ( version : string ) : ILVersionInfo =
840- let parseOrZero v = match System.UInt16.TryParse v with ( true , i) -> i | ( false , _) -> 0 us
840+ let parseOrZero i ( v : string ) =
841+ let v =
842+ // When i = 3 then this is the 4th part of the version. The last part of the version can be trailed by any characters so we trim them off
843+ if i <> 3 then
844+ v
845+ else
846+ (( false , " " ), v)
847+ ||> Seq.fold( fun ( finished , v ) c ->
848+ match finished with
849+ | false when Char.IsDigit( c) -> false , v + c.ToString()
850+ | _ -> true , v)
851+ |> snd
852+ match System.UInt16.TryParse v with
853+ | ( true , i) -> i
854+ | ( false , _) -> 0 us
841855 let validParts =
842856 version.Split( '.' )
843- |> Seq.map parseOrZero
844- |> Seq.takeWhile ((<>) 0 us)
857+ |> Array.mapi( fun i v -> parseOrZero i v)
845858 |> Seq.toList
846859 match validParts @ [ 0 us; 0 us; 0 us; 0 us] with
847860 | major :: minor :: build :: rev :: _ -> ILVersionInfo( major, minor, build, rev)
You can’t perform that action at this time.
0 commit comments