PDA

View Full Version : How do find if file is in the PATH?



mgaredia
03-24-2006, 03:06 PM
I want to step through each directory in PATH and see if 3rd party dll exist in any one of the directories mentioned in PATH? I am using Search File System but it asks to specify search directories manually. How do I specify PATH variable?

enanrum
03-29-2006, 11:33 AM
I do not know if you can use the Dir Search action! You can write a custom action to do it!



public void onExecutingSearchPath(com.installshield.event.wizard.WizardActionContext arg0)
{
try {
String path = arg0.resolveString("$N($E(PATH))");

String[] paths = path.split(";");
for(int y=0; y < paths.length; y++ ){
String inFile = paths[y] + "\\file.dll";
File f = new File(inFile);
if(f.exists()){
arg0.getServices().getISDatabase().setVariableValue("DLLFOUND", "true");
}
} catch () {
}
}

Then for whatever your doing with the dll component or feature just put in the condition 'String Comparison' see if $V(DLLFOUND) = true

Regards,
Tom