If you set the Need Target Application Directory configuration setting to True, the first time the user runs Stonefield Query, it prompts them to specify the location of the target application. If you want to ensure that the user selected the correct directory, create some code for the Application.ValidateTargetAppDir script, such as checking for the existence of the main executable file for the application. Return False from the script if the selected directory is invalid. You can control the warning message displayed to the user if the directory is invalid by setting the Message for Invalid Target App Directory property.

Parameters
A reference to the Stonefield Query Application object and the directory chosen by the user (terminated with a backslash).

Return Value
True if the directory the user selected is the correct one.

Example
Here's an example that checks if MYAPP.EXE can be found in the directory the user selected.

Visual FoxPro

lparameters toApplication as SQApplication, tcDirectory
return file(tcDirectory + 'myapp.exe')

VBScript

function Main(Application, Directory)
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
Main = fso.FileExists(Directory & "myapp.exe")
end function

JavaScript

function Main(Application, Directory) {
var fso, Found ;
fso = new ActiveXObject('Scripting.FileSystemObject') ;
Found = fso.FileExists(Directory + 'myapp.exe')
return(Found) ;
}

See Also
Application.GetDefaultTargetAppDir | Application.ValidateCommonAppDir | Message for Invalid Target App Directory | Need Target Application Directory | Scripts