Use the file_exists function, which will check if a file exists on a system. The function can be found in the <WinRunner>\samples\utils\ext_func\tests\ext_fun c file. The return code from the file_exists function should be 0 if the file or directory exists.
load_dll(getenv("m_root") & "\\samples\\utils\\ext_func\\src\\ext_func.dll ");
extern int file_exists(in string);
rc = file_exists("d:\\test.txt");
Hope this serves your purpose or gives you other ideas for implementing.
or in whichever drive WinRunner is installed that path is taken. And there is no problem if the M_ROOT value is not updated in the wrun.ini as by default it takes the above path depending on the drive in which it is installed.
As bnrani stated, by default Winrunner uses the installation path from the registry. The system is designed to use an either or. If the path is blank, or the default, then it uses it's installation path. If the path contains a string, the system will use this. Basically, to populate this path if it is anything other than the default is redundant.
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by anoopt: I think I am missing something. I just wanted to know in which case the path is not set in wrun.ini file after installation. The application gets installed and works fine.... <HR></BLOCKQUOTE>
If this happens then a way would be to define a constant with the path you need in a starup script and load the script when WR starts.
You can refer to this constant then anywhere in script.
Or we can just edit the file and add the path... ..
I have not installed in the default path. So as I believe.. the wrun.ini file should contain the path without me editing it. What CSnuts has explained is why everything is ok eventhough it is blank right?
Correct me if I am wrong...
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)