I need the installer to modify the HOSTS file and add a line to it and can't figure how to do it?
Also, is there a way to verify if the line is already present in the file and update the file only when needed?
Thanks.
Code: Select all
var check_sip = Session.Property("CHECK_SERVER_IP_FLAG");
function ValidateIPaddress(ipaddress)
{
if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress))
{
return true;
}
return false;
}
var sip = Session.Property("SERVER_IP");
check_sip = ValidateIPaddress(sip);
I'm afraid I don't fully understand your uninstall scenario. Can you please send us the .aip (project file) to support at advancedinstaller dot com and give us more details about the behavior you want to implement on uninstall?One more question: Could I perform file move operation after file removal during uninstall.
Because I set file removal on removing all files that begins on hosts*, then set file move on moving bk-hosts to hosts in same ../driver/etc folder, but problem is always performs file move then file removal, so renamed hosts file is also deleted.
Yes, this is possible by using a custom action. For example you can use a custom action without sequence which will set the "CHECK_SERVER_IP_FLAG" property (to "valid" or "invalid") based on the "SERVER_IP" property value. Then you can conditionally display a spawn dialog based on your "CHECK_SERVER_IP_FLAG" property value. Also, you can adjust your custom action code like this:Is it possible to validate ip address in the edit box ?
Code: Select all
function ValidateIPaddress(ipaddress)
{
if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress))
{
Session.Property("CHECK_SERVER_IP_FLAG") = "valid";
return true;
}
Session.Property("CHECK_SERVER_IP_FLAG") = "invalid";
return false;
}
var sip = Session.Property("SERVER_IP");
ValidateIPaddress(sip);
FOLLOW US
Get the latest news in Application Packaging