Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DzClass CheckForFile
Message
 
 
To
13/06/2002 07:11:44
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00667829
Message ID:
00667878
Views:
12
>Hi Mark,
>
>I use your class for a While, its a creat help.
>
>In the last time one problem rose up.
>
>So I will give it to you.
>
>If the file for zip operation is in root (F:\myGile.zip), the operation fail.
>
>I do not fully understand the logic of "CheckValidPath" and "CreatePath" but lnRetVal = adir(laFiles, tcPath, "D") returns 0 for tcPath='f:\' and md fails as well.
>
>I will add some code to "CheckValidPath" to check for root
>
>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	
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform