Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Having problem setting oldpath and newpath using CD comm
Message
De
28/01/2004 12:23:21
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00871446
Message ID:
00871462
Vues:
16
>I am issuing a "CD" command to use getfile(). When I go to reset the my path to orginal path, the fullpath doesn't change. Here is the snippet of the code:
>
>
>WITH thisform
>	LOCAL lcNewDir,lcOldDir,z,d,f && z=returned path and filename, p=path split, f=file split
>
>	lcOldDir = .Dirloc1.gv_fullpath
>	lcNewDir = .Dirloc1.gv_docpath
>	IF FULLPATH(curdir()) != lcNewDir
>		CD (lcNewDir)
>	ENDIF
>	.z = GETFILE() && get directory and file name
>	b = RAT('\',.z) && find last '\'
>	l = LEN(.z)
>	.f = right(.z,ABS(b-l)) &&  file
>	.d = left(.z,b) && directory path
>
>	IF FULLPATH(curdir()) != lcOldDir **** this is where I am having problems
>		CD (lcOldDir)
>	ENDIF
>	IF VARTYPE(.z) = "C" AND !EMPTY(.z)
>		.t1.value = ALLTRIM(.z)
>		.t2.setfocus()
>		.t2.refresh()
>	ELSE
>		MESSAGEBOX('No file was choosen',0,'Warning')
>	ENDIF
>ENDWITH
>
>
>here is what my 2 path equal too:
>
>.Dirloc1.gv_fullpath = c:\programming\programs\vfp8\contract_track
>and
>.Dirloc1.gv_docpath = c:\programming\programs\vfp8\contract_track\documents\
>
>
>What is it that I am doing wrong here? I am check the paths before using CD because it gives me errors if I already have same path.
>
>thanks
>Nick Patel

If you don't have set exact on then a statement like
? "ab" <> "a" returns .f. 
because foxpro stops comparing when the right side of the string is done. So maybe you could set exact on or do an exact match comparision.
  IF .NOT. FULLPATH(curdir()) == lcOldDir
Charles

"The code knows no master." - Chuck Mautz
"Everybody is ignorant, only on different subjects." - Will Rogers
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform