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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with SYS(2005)

Status
Not open for further replies.

jschenke

Programmer
Jun 19, 2001
48
BE
Hi all,

I've come across a strange problem working with FoxPro/Win 2.6a under Win2K :
SYS(2005) returns "C:\FPW26\\FOXUSER.DBF" instead of "C:\FPW26\FOXUSER.DBF", which is what it returns under my old Win95 development machine.

In our program we apply the following routine:
USE (SYS(2005)) AGAIN ALIAS ResAgain IN 0
as we store the color settings and the locations of the windows there for easier retrieval later on.

The above line works fine under Win95, and in the standalone .exe as well ; under Win2K the IDE will generate a "File access denied" error.

However, replacing the above line with
USE SUBSTR((SYS(2005), RAT('\',SYS(2005))+1) AGAIN ALIAS ResAgain IN 0
seemed to do the trick -- not in the least because the path of the resource file is included in the PATH environment variable.

As I've noticed the same extra '\' behaviour in the LIBRARY environment variable, I figured I'd post this hint onto the forum...

Best regards,

Jan Schenkel

"As we grow older we grow both wiser and more foolish at the same time." (De Rochefoucald)
 
I haven't run into that situation but I'll have to look out for it. By the way, this should do the trick too:

USE STRTRAN(SYS(2005), '\\', '\') AGAIN ;
ALIAS resagain IN 0

Dave S.
 
Hi Dave,

You're right: that does the trick too ; and even better, as the path might accidentally contain multiple foxuser files -- we all know how keen users are to drag files around and/or make numerous duplicates..

So far I haven't had the chance to figure out if this occurs in any other routine or not ; but I'll definitely have a look at the other paths with the trusty debug window..

Thanks for the response,

Jan Schenkel.
 
UPDATE:

Sorry Dave, I replied to you from home without testing it ; now I'm back at work, and unfortunately, it doesn't work.

The fun part is that when I check for the table name via
DBF("RESAGAIN")
with my version, I get the exact same response as
SYS(2005)

So when I specify a full path for my FOXUSER, I don't have file access, and if I don't specify a path, I do? *boggle*
I haven't had the time yet to setup more users, so there's only the _administrator_ who iirc should have full access.

Just thought you'd like to know...

Jan Schenkel.
 
I'm thinking you're dealing with two different files, since in your scenario, you're not really telling it to point at the SYS(2005) file, just the name of the file referred to by SYS(2005). So if there is a FOXUSER laying around somewhere in your path statement, it will get picked up whereas the 'real' one may not, or may not be accessible. I tried both of our commands, (I had to tweak yours a little, I was getting an error):

USE SUBSTR(SYS(2005), RAT('\', SYS(2005))+1) ;
AGAIN ALIAS ResAgain IN 0

Now if you issue:

?SUBSTR(SYS(2005), RAT('\', SYS(2005))+1)

you will get the result 'FOXUSER.DBF'. Since I was doing this from my startup directory, there is a foxuser file there.

If you use:

?STRTRAN(SYS(2005), '\\', '\')

you will get the result, well in my case:

'C:\FOXPROW\FOXUSER.DBF'

Which is pointing to the foxuser in my startup directory.

Dave S.
 
Hi Dave,

I had SET FULLPATH ON, so I could check the entire path ; and the drive+path+filename for DBF("RESAGAIN") was exactly the same as for SYS(2005).

That's why I was so surprised that one worked and the other, pointing to the same file, didn't. It would have been logical (well, sort of -- at least it would have made a bit more sense) if it were two different files, but they're the same.

Jan Schenkel.
 
Hi Dave (and anyone else faced with this problem)

After a lot of searching I found that the problem was in the config.fpw file in the startup folder as specified in the shortcut.

The DEFAULT got set to a non-existent directory, and this caused mayhem further on: last night, I couldn't even SET LIBRARY TO FOXTOOLS which was a real cause for panic as I was facing a deadline.

This morning after a not-so-good-night-of-sleep I decided to check and subsequently redirected the DEFAULT setting to an existing directory, and everything ran smoothly again in the IDE.

And the problem with the double backslashes in SYS(2005)disappeared instantaneously as well. So doiuble joy !

Granted, the stand-alone executables had kept working, so I could have continued development. But can you imagine life without a debug window?

Anyway, as the same setup worked fine under Win95, but broke under Win2K, I hope this little post will help others facing this or similar issues...

Jan Schenkel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top