Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DzClass CheckForFile
Message
De
13/06/2002 09:27:31
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
00667829
Message ID:
00667891
Vues:
19
Hi Sergey,
I need a little bit more help, this is beyond my limits.

Do I see right. You have changed to
PROTECTED PROCEDURE CheckValidPath
...
If not CreatePath(lcPath)
  return ""
endif
....
ENDPROC
to
PROTECTED PROCEDURE CheckValidPath
...
If not CreatePath(lcPath)
  return "????"
endif
....
ENDPROC
and add line
lcPath = Left(tcPath, Len(tcPath)-1)
to CreatePath?

A deeper look in DynaZip.prg shows me:
If a call CheckValidPath('C:\') (this is the common call for .cZip_ZipFile='C:\MyFile.Zip' form cZip_ZipFile_Assign)

CreatePath() is returning .F. and CheckValidPath is returning "????". o.k. cZip_ZipFile_Assign will handle this. But I get no information about the readwrite status. (For c:\ this should not be a problem but for a mapped drive?)

cUnz_Destination will be set to "????"
cZip_PFTLoc will be set to "????"


Do you have a reason against:
PROTECTED PROCEDURE CreatePath
 LPARAMETERS;
  tcPath

 IF !DIRECTORY(tcPath) THEN
  MKDIR ALLTRIM(tcPath)
 ENDIF
 RETURN DIRECTORY(tcPath)

ENDPROC
?

Agnes

>You don't have to check for a root. The corrected code below takes also care of extra trailing spaces in the path.
PROTECTED PROCEDURE CheckValidPath
>	lparameter tcPath
>		local lcPath, lcFile, lnHandle, lnRetVal
>		lcPath   = addbs(tcPath)
>		if not CreatePath(lcPath)
>			return "????"
>		endif
>		lcFile   = SUBSTR(SYS(2015), 3, 10) + ".txt"
>		lnHandle = fcreate(lcPath + lcFile) && test to see if files can be written to destination
>		if lnHandle < 0
>			return ""
>		endif
>		lnRetVal = fclose(lnHandle)
>		erase (lcPath + lcFile)
>		return lcPath
>	ENDPROC
>	
>	
>PROTECTED PROCEDURE CreatePath
>		lparameter tcPath
>		local lnRetVal, laFiles[1], lcPath
>		lcPath = Left(tcPath, Len(tcPath)-1)
>		lnRetVal = adir(laFiles, lcPath, "D")
>		if lnRetVal = 0
>			md (tcPath)
>		endif
>		lnRetVal = adir(laFiles, lcPath, "D")
>		return (lnRetVal > 0)
>	ENDPROC	
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.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform