Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

directory name is invalid.

Status
Not open for further replies.

sdocker

IS-IT--Management
Aug 12, 2010
218
GB
I have an app that seems to be working fine, till the user exits. The folder becomes temporarily unavailable. If they try to run the app again, they get a message that "x:\folder\xxx\desktop\file.dbf does not exist". This happens when they run it from a desktop shortcut. The folder actually disappears from windows explorer. It reappears in a few minutes/seconds.

If they run the app from windows explorer, (immediately after exiting), they get a message "The directory name is invalid." After a short interval, it once again works fine.

The app is installed at several hundred different clients and this is the only one with this issue.

Any helps is appreciated
Sam
 
That sounds like either an anti-virus issue, or a virtualisation one.
You could do a check for the folder before you try and use the .dbf
and pop a short delay in and try again - perhaps displaying a splash screen
while you do it?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Hi,

The most sensible answer is to check what is different on this client configuration compared to the other hundred clients.

Stay healty,
Koen
 
Koen, that's not always easy - I don't think most clients would let you investigate that deeply unless
they are near enough to do a site visit. I suppose these days you could try a zoom meeting...

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I agree with Griff, especially if these are non-techie people. I've known many non-tech users who don't even know which version of Windows they are using (and there is no reason why they should).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I'm not sure if I can give a solution, but it might be worth a look.

First things that come to my mind in such cases are shadow copy folders and UAC.

Well, shadow copies are usable for folders and volumes, but as soon as windows makes a shadow copy of a volume/folder/file, it might block access to files that are just being processed and this might result in the message, that the customer receives.

UAC, on the other hand, usualy fires a dialog box if something needs intervention. I've had customers that never ever notice this dialog box as it constantly vanishes behind already open windows and the only way to notice this would be a look at the flashing symbol in the taskbar. Well, you might think that someone who doesn't notice this must be well on his way of becoming blind, but honestly, with a taskbar that vanishes automatically (and we all know, that windows often hangs with this handling until you press the windows key), you don't have a chance to notice it.

That being said, with UAC, the folder/file wouldn't be availlable ever again, until the last open/blocking window is closed. IMHO, the OPs description doesn't fit here.

Therefore I'd take a look at the customers shadow copy configuration. Perhaps the timer has to be set to a later time of the day.

JM2C




-Tom
 
Are you issuing

Code:
net use /delete

Or similar code to unmap a drive you map at program start?


Chriss
 
Thanks for all the replies.

Ill follow up and get back.

Sam
 
Chriss,

No mapping at all. User selects an existing drive for app and/or data location.
Sam
 
Hi,

Your error "The directory name is invalid." Makes me believe your path is messed up. What is the code for directory setting / set path ?
Do you have any idea on which procedure this happens? What does you errorlogging tell you?
'If they run the app from windows explorer' Do you mean if they click on the .exe icon or the shortcut icon of your .exe?
And you say if.., is there then an other way to start your exe?
Stay healthy,
Koen
 
Tom Borgmann,

Both your suggestions make sense, but I think they would be issues for their IT department. I will mention it and see they say.

Sam
 
Koen Pillar,

The directory is set with SYS(5) + SYS(2003). Remember the issue only arises when they exit the app and immediately re-invoke.

It occurs in the main prg module. Sometimes my error handler is not invoked, and it displays an OS error/message. Sometimes it gets a little further and the error occurs in Net_Use. It is looking for the file on the desktop, and issues VFP error # 1 "File does not exist". I think it is looking in the desktop because the folder it should be looking in is unavailable.

There is a shortcut on the desktop. The Target and Start-In are correct. It can also be invoked by double clicking the EXE in explorer.

I don't think the path is wrong. What happens is the directory seems to become temporarily unavailable. It does not show up in windows explorer. It reappears after a short interval.

Sam
 
Sam,

This is a bit of a long shot, but I'll mention it anyway.

At any point in the application, does the user have the possibility of printing to a PDF? In particular, can they print a VFP report, and choose a PDF driver as the destination printer?

The reason I ask is that, if the PDF driver prompts the user to specify a destination for the output file, and if the user then navigates to a directory other than the driver's default, then that could in certain circumstances muck up VFP's default directory. To guard against that, it's good advice always to save the VFP default directory before issuing a command that could lead to printing to a PDF, and to restore it afterwards.

I admit that this does not explain the behaviour you are seeing, but it is something that I think we should all keep in mind.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike,

The app can print to a PDF driver, but the program never gets that far. The error occurs after about 60 lines of pure simple code, except for 1 ADIR() function call: mostly setting SETs and other assignments.

Sam
 
Sam,
how do you set your path? Sys(3)+sys(2005) do not set your path they give you a directory but do not set your path, to set your path you have to issue a
Code:
set path to
followed by a list of directories.

a path setting, which is done at the beginning of your application could be:
Code:
lcPath = fullpath( curdir(), [class, data,images]
set path to ( m.lcPath ) additive
since you have an error a file does not exist, although the file does exist, my best bet is your path is mixed up and you should read instead of ' x:\folder\xxx\desktop\file.dbf does not exist ' (error 1) as 'cannot find the file'
You also mention that your files are on your desktop, that is strange and unusal, let it be that you have created a directory x:\folder\xxx\desktop\.

Stay healty,
Koen
 
it gets a little further and the error occurs in Net_Use

I asked about net use, so you do use such or similar code, wrapped in a function or Windows API call.
Now, it would really help to see what code runs to fix it.

From the symptoms it's very likely you map something at the start and unmap it at the program end.

You're also likely not fully aware of what the code is doing, as you perhaps use a Framework wrapping a few things, in the Net_Use call you mention. This isn't a native VFP function or command. So it may use a Run /N of a shell command like net use or declares and uses a Windows API call. And these can both return before the mapping is done.

Then all you might need to add is waiting for the path to exist with a while loop checking DIRECTORY() until it returns .T. or a timeout occurs.

Also notice:

a) The "Start-In" Directory defined in a shortcut will be the SET('DEFAULT') before the first line of your code runs, this directory must exist before you could do any mapping.
Then you can only advise users to configure their shortcuts correctly.

b) both GETDIR() and GETFILE() dialogs return empty values when the user clicks CANCEL. So don't try to set or map anything to an empty string as directory.
If that's the reason it could also explain why it only doesn't work with one user. Perhaps he's the only one canceling out of this, not knowing what directory to pick.

Chriss
 
Koen,

This is the code

Code:
CurrDir = SYS(5) + SYS(2003)
IF RIGHT(CurrDir,1) == "\"
    * DO NOTHING
ELSE
    CurrDir = CurrDir + '\'
ENDIF

File_1 = LoggedPath(CurrDir + "CLDATA" + RIGHT(ALLTRIM(STR(xYear)),2) + ".DBF")

The files are not on the desktop. The app just seems to be looking there because the correct folder is temporarily unavailable.

Sam
 
Chriss,

I don't do any mapping. It is done by the user's IT dept., using GPO (Group Policy Objects).

I didn't mean only one user has this issue. I meant only one customer installation is experiencing it.

I have asked the user to see if this issue occurs if the app is installed on a standalone.

I'll get back when I have an answer.

Sam
 
Hi Sam,

instead of using this code

Code:
CurrDir = SYS(5) + SYS(2003)
IF RIGHT(CurrDir,1) == "\"
    * DO NOTHING
ELSE
    CurrDir = CurrDir + '\'
ENDIF

you should use this function

Code:
  CurrDir = ADDBS( SYS( 5 ) + SYS( 2003 ) )

ADDBS() (=Add BackSlash) only adds a Backslash if there isn't one yet. So, you'll do no harm in using it per se.

-Tom
 
Sam,
Your code
Code:
currDir = SYS(5) + SYS(2003)
IF RIGHT(CurrDir,1) == "\"
    * DO NOTHING
ELSE
    CurrDir = CurrDir + '\'
ENDIF

File_1 = LoggedPath(CurrDir + "CLDATA" + RIGHT(ALLTRIM(STR(xYear)),2) + ".DBF")

is not a path setting. It is a loading of a particular .dbf as variable File_1

Do you have any idea what the method LoggedPath is?

Could it be that you are working with a legacy application from somebody else?

Stay healthy,
Koen

P.S. Tom is correct about the use of the function addbs(), however it will not solve your problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top