>>>Hi.
>>>As File() searches along SET PATH as well what is a simple way to assertain that the file really exists where i am looking for it?
>>>I was thinking FOPEN(), but...
>>>Thank you.
>>
>>Kamil,
>>
>>Gregory's way searches the Windows path as well. If you want to know if the file exists without searching any path
FUNCTION FileNoPath(tcFilename AS String)
>>
>>* tcFilename is the fully qualified file name
>>
>> LOCAL llresult, lcpath
>> lcpath = SET("PATH")
>> SET PATH TO
>> llresult = FILE(tcFilename)
>> SET PATH TO (lcpath)
>> RETURN llresult
>>ENDFUNC
>
>hi George,
>
>My first thought reading your reply was: Hell, I didn't suspect that.
>
>So, I've done a few tests and all of the examples below return FALSE.
>Also, the doc about GetFileAttributes() does not mention a search in the windows path. (while CreateProcess() does)
>
>Anything I am missing ?
>
>
>?FileExists('system.ini')
>?FileExists('kernel32.dll')
>?FileExists('command.com')
>
>
>from the (dos)command window
>
>echo %path%
>C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;c:\progra~1\isabel\bin;c:\progra~1\isabel\maxware;C:\PROGRA~1\ATITEC~1\ATICON~1;C:\bin;C:\PROGRA~1\Java\JDK15~1.0\bin
>
>
>In addition, I believe that when running an exe and SET PATH TO (empty), any file included in the exe will be found with FILE()
Gregory,
The FILE() function maps to the API function FindFirstFile().
According to the Platform SDK:
In rare cases, file attribute information on NTFS file systems may not be current at the time you call this function. To obtain the current NTFS file attributes, call GetFileInformationByHandle.It seems to me that my suggestion is a lot cleaner than using the internal Windows API.
George
Ubi caritas et amor, deus ibi est