Created
February 5, 2018 18:48
-
-
Save chasemc/cbb7f1cca4d261890096a9da2f05264d to your computer and use it in GitHub Desktop.
Adding Rtools dependency to RInno
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define IncludeRtools true | |
#-------------------------------------- | |
#if IncludeRtools | |
Source: "Rtools34.exe"; DestDir: "{tmp}"; Check: RtoolsNeeded | |
#endif | |
#--------------------------------------- | |
#if IncludeRtools | |
Filename: "{tmp}\Rtools34.exe"; Parameters: "/SILENT"; WorkingDir: {tmp}; Check: RtoolsNeeded; Flags: skipifdoesntexist; StatusMsg: "Installing Rtools if needed" | |
#endif | |
#-------------------------------------- | |
// Is Rtools installed? | |
function RtoolsDetected(): boolean; | |
var | |
v: Integer; | |
success: boolean; | |
begin | |
for v := 0 to (RVersions.Count - 1) do | |
begin | |
if RegKeyExists(HKLM, 'Software\\WOW6432Node\R-core\Rtools') or RegKeyExists(HKCU, 'software\WOW6432Node\R-core\Rtools') then | |
success := true | |
if success then | |
begin | |
RRegKey := 'Software\\WOW6432Node\R-core\Rtools'; | |
break; | |
end; | |
end; | |
begin | |
Result := success; | |
end; | |
end; | |
// If tools is not detected, it is needed | |
function RtoolsNeeded(): Boolean; | |
begin | |
Result := not RtoolsDetected; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment