Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Anyone know of a way to check for valid path?
Message
De
28/02/1999 04:14:53
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
27/02/1999 15:30:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00192165
Message ID:
00192423
Vues:
19
>>does the following work as well?
>>
>>
>>mytest = lcPath + "\nul.txt"      && nul.txt should exist in every directory!
>>if file(mytest) then && dir exists
>>    copy file (myhappyfile) to (lcPath)
>>else
>>    md lcPath
>>    copy file (myhappyfile) to (lcPath)
>>endif
>>
>>
>
>A second problem here - in addition to the nul.txt being an invalid test, you must supply the full name of the tart file, not just a path prefix; IOW, the copy command would need to read:
>
>COPY FILE (myhappyfile) TO (lcPath + JUSTFNAME(myhappyfile))
>
>JUSTFNAME() is a native function for VFP 6; it requires FOXTOOLS.FLL to be loaded in earlier versions.

The shortest (for lazy programmers):
if not directory(lcPath)
   md (lcPath)
endif
COPY FILE (myhappyfile) TO (ForcePath(myhappyfile, lcPath))
ForcePath() is another FoxTools citizen who made it into regular citizenship in VFP6.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform