Hi Gregory,
I can not agree that vfp opens the file on disk first. I compiled my exe, do small changes to the table, run the exe, USE the file and browse. The changes are not there. Or do you means it runs trough path and the like for the filename?
Then for it could not find a table on my comp. ::)
Where do you find the information about the way vfp search for the file to use? I do not find something in the help file.
Agnes
>hi Agnes,
>
>I tried this on a customer's computer (not IDE) before posting.
>
>I have a table \Project\Moses\Internal\Moses.dbf which is included
>
>In runtime (and
not on the computer I develop on), File('.\Internal\Moses.dbf') is TRUE, whereas FileExists('.\Internal\Moses.dbf') is FALSE
>
>I have to add that vfp first tries to find the file on disk, and failing that, it looks in the included list of files. So if you try this in an exe make sure the file is not on the disk (rename it temporarily) in order to get the good results
>
>
>>Hi Gregory,
>>
>>I failed with that.
>>
>>As far as I see you try to check if GetFileAttribute() returns a failure code.
>>
>>You may achieve this result using build in ADIR
>>
>>*--------------------------------------------------------------------------
>>Function FileExists(FileName)
>>
>> return !EMPTY(ADIR(laDir,FileName))
>>endfunc
>>*--------------------------------------------------------------------------
>>
>>
>>I open the table from my exe and run your or my function with DBF() as parameter. It returns .T. (DBF() points to the position where the file is stored on my comp). It is definetly not the on the comp opend because this is ReadWrite and ISREADONLY(DBF()) returns .T.. The DBF() of the table included in the exe is the full path to the location where its compiled from.
>>
>>If I try with just TheTableName.dbf it returns .F. what it should do because the table is not on the place where the exe is stored and not to find using PATH.
>>
>>ISREADONLY() on the other hand will will not be of any use in this because the file on the comp may be readonly. (It's normale state in SourceSafe for me)
>>
>>Agnes
>>
>>
>>>Guillaume,
>>>
>>>File() will return TRUE for both built-in/external tables/files
>>>
>>>FileExists() will return TRUE only for external tables/files (RunTime, this is)
>>>
>>>
>>>*--------------------------------------------------------------------------
>>>Function FileExists(FileName)
>>> declare Integer GetFileAttributes in win32api string @
>>>
>>> return (GetFileAttributes(@FileName) <> -1)
>>>endfunc
>>>*--------------------------------------------------------------------------
>>>
>>>>Hi,
>>>>
>>>>Is there a way to determine if a certain table is included in the project or not? Before it is opened, I need to determine if it's a build-in or external table .
>>>>
>>>>Thanks again
>>>>
>>>>Guillaume
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]