Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SET DEFAULT or CD (change directory) bug?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
SET DEFAULT or CD (change directory) bug?
Divers
Thread ID:
00899075
Message ID:
00899075
Vues:
52
Call me an optimist, but the following code should return a successful status if the folder being checked exists (using SET DEFAULT or CD inside a TRY/CATCH), or a failed status if the folder does not exist or is not currently available (such as a network drive, removable media etc):
** can we create the bank batch file?
** This causes some systems to crash by leaving them in a different folder (works OK on most systems)
** a bug in vfp8?
if company.directbank and !empty(company.bankfile) and !inlist(left(UPPER(company.bankfile),1), 'A', 'B')
	mnResponse=4
	do while mnResponse=4		&& retry loop
		mlError=.f.
		mcCurDir=sys(5)+sys(2003)
		mcBankPath=UPPER(JustPath(company.bankfile))

		try
			set defa to &mcBankPath
		catch
			mlError=.T.
		endtry
		
		set defa to &mcCurDir
		
		if mlError
			mnResponse=messagebox('The location for the direct credit file ';
+ALLTRIM(company.bankfile);
+' to be produced by this pay does not seem to be available.'+CRLF ;
+'This may be due to a setup error or network drive no longer available or a problem accessing the folder ';
+mcBankPath+'.'+CRLF ;
+'(you can change the filename in Company Setup..Bank if you need to)'+CRLF+CRLF ;
+'Choose Ignore if you wish to continue anyway',50,'Direct Credit File Error')

			if mnResponse=3
				return
			endif
		else
			mnResponse=0
		endif
	enddo
endif
The problem arises in a small percentage of sites (from a sample of over 1000 sites running various versions of Windows, XP Home, 98 etc).

The initial
set defa to &mcBankPath
fails (even though the directory being checked for is C:\ in some cases, which obviously does exist). The code manages to set the mlError status to TRUE, but doesn't successfully execute the return to the current folder using
set defa to &mcCurDir
This leaves the program running in "someotherfolder" rather than the original execution folder, and consequently if the user attempts to continue running the routine it fails when trying to access the tables which should be available in the current folder.

Is this proper behaviour? Has anyone else experienced this?

Hope someone can shed some light on this perplexing problem.

Matt.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform