File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 7
7
using System . Collections . Generic ;
8
8
using System . Collections ;
9
9
using System . Linq ;
10
+ using System . Text . RegularExpressions ;
10
11
11
12
namespace RDotNet . NativeLibrary
12
13
{
@@ -306,7 +307,11 @@ public static Version GetRVersionFromRegistry(StringBuilder logger = null)
306
307
if ( subKeyNames . Length > 0 )
307
308
version = subKeyNames [ 0 ] ;
308
309
}
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 ) ;
310
315
}
311
316
312
317
private static string GetRCurrentVersionStringFromRegistry ( RegistryKey rCoreKey )
You can’t perform that action at this time.
0 commit comments