Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sure_File()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00927285
Message ID:
00927648
Vues:
27
_______________________________________________
>George,
>
>Let's recap
>
>Kamil wants to find out if a file exists where he wants it avoiding the PATH search
>
>GetFileAttributes() suits me.
>
>You anwer 2 things (1) GetFileAttributes() searches along the windows path and (2) suggest setting the PATH to '' before applying FILE()
>
>(1) The tests I have done show that GetFileAttributes() does not search along the windows path
>
>(2) When you run in an exe or an app, setting the PATH to '' prior to using FILE() searches the files included in the exe/app and may return wrong results whereas GetFileAttributes() will return -1
>
>The rare cases you refer to apply to the FindFirstFile() function and the FileAttributes returned by it (from the SDK)
>Then why would FILE() be much cleaner than GetFileAttributes() ??? (since FILE() uses FindFirstFile() which is the internal Windows API)


Gregory,

It's "cleaner" because it doesn't rely on the API. Now I'm as big a fan of extending VFP through the use of the API, but when other internal solutions are available, I tend to stick with those.

In a situation such as this, I believe that it's bsst to store the file name and path in a table. This allows me to do two things. First, if the location changes. I don't have to modify any code. Second, I don't have to rely on any external functions.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform