Skip to content

Commit ceaa9ec

Browse files
committed
Merge remote-tracking branch 'C_tpetricek/master' into devel
2 parents 008b394 + 3a91416 commit ceaa9ec

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

RDotNet.NativeLibrary/NativeUtility.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Collections.Generic;
88
using System.Collections;
99
using System.Linq;
10+
using System.Text.RegularExpressions;
1011

1112
namespace RDotNet.NativeLibrary
1213
{
@@ -306,7 +307,11 @@ public static Version GetRVersionFromRegistry(StringBuilder logger = null)
306307
if (subKeyNames.Length > 0)
307308
version = subKeyNames[0];
308309
}
309-
return new Version(version);
310+
// Version should normally be "3.2.4", but some releases had
311+
// "3.2.4 Revised" in which case constructor for Version fails.
312+
// The regex first extracts the numerical part of the string.
313+
var reg = new Regex("([0-9]*\\.)*[0-9]*");
314+
return new Version(reg.Match(version).Value);
310315
}
311316

312317
private static string GetRCurrentVersionStringFromRegistry(RegistryKey rCoreKey)

0 commit comments

Comments
 (0)