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!

Default PATHs not persisting. 2

Status
Not open for further replies.

Don Child

Programmer
Apr 4, 2003
64
US
Hi,

This was happening since we started looking at this project. Since there were spaces in some of the subfolders, we thought the problem might be related to that. So we tried putting all paths in quotes, but we had the same problem.

The problem is that VFP 9 isn't keeping our folder PATH settings. We have about 10 paths, something like

"c:\root\"
"c:\root\code\"
"c:\root\FORMS\"
"c:\root\BITMAPS\"
"c:\root\BITMAPS\OTHERS\"
"c:\root\ClassFiles\"
"c:\root\DATA\"
"c:\root\Menus\"

, etc.


Originally, some of these folders had spaces, so we re-created the project without spaces. Also, we originally didn't end the PATHs with a slash \, but we speculated that VFP was expecting them. Now, we're not sure anymore.


We start each session with

CD c:\root\ (per a suggestion on this forum)
DO (HOME() + "envmgr.app") with "-m"

, and then check Tools/Options/File Locations/Search Path

Some of the time, the Search Paths from a previous session are still in there. But most of the time, some or almost all of the Search Paths are gone.

So each of these times, we have to modify the Search Path, and manually paste in

c:\root\ ; c:\root\code\ ; c:\root\FORMS\ ; c:\root\BITMAPS\ ; c:\root\BITMAPS\OTHERS\ ; c:\root\ClassFiles\ ; c:\root\DATA\ ; c:\root\Menus
(and others). Then we check Tools/Environment Manager, and we can see them all there.

How do we get them to persist? We've tried quotes around all of the paths, ending with or without the back slash.

And the strange thing is, that it's sporadic. Sometimes the paths persist from session to session, and sometimes they don't.
 
Hi,

You enter them in Tools - Options - File Locations - Search Paths and click on "Set As Default". If you only click on "OK" they vanish asa you leave VFP.

hth

MarK
 
When you CD to C:ßroot, all the PATHs can be relative. So CD c:\root, SET PATH TO .\Code, .\Forms,...

CD and SET DEFAULT are the same, so if you find something changing that you'll have to set this straight again. Default Path is an options setting in File Locations, as MarK already pointed out these options have to be Set As Default to be persisted, but that'll only work for a single project. If you set these things in the Environment Manager, you have to open your project via the manager, not via double click, so the environment is set. Also, even as apersisted option the default path is not a hard setting, any CD or SET DEFAULT command in code can change that. The options File Locations setting is only valid for the start, you have to ensure it's not changed or only changed temporally and set back.

Chriss
 
As the others have said, the settings should persist, provided you click "Set as Default" in Tools / Options.

Another approach is to create a startup program containing a command similar to the following:

Code:
SET PATH TO Code, Forms, Bitmaps, Data  && etc.

These paths will be relative to the default directory, which you can easily change by CD or SET DEFAULT each time you move to a different project.

I doubt if the presence of spaces in the folder names would prevent the path from persisting.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi,

I doubt if the presence of spaces in the folder names would prevent the path from persisting.

Spaces are allowed e.g. "C:Users\My Name\VFP9Projects\..." in "File Locations" works

hth

MarK
 

"You enter them in Tools - Options - File Locations - Search Paths and click on "Set As Default". If you only click on "OK" they vanish asa you leave VFP."

Yes. Yes. This is what's happening. And it's the part where I slap the side of my head and say, "Ugh. Of course. How could I be so stupid"

Ok, thanks Mark.



Chris,

Yep, I undererstand this is project-level. So far, I've only pulled up VFP for one project.

The CD applies to the root of all of the PATHs, which in the example would just be C:\root.

"If you set these things in the Environment Manager, you have to open your project via the manager, not via double click, so the environment is set."

Ah. So that's the difference. Ok, thanks.



Mike,

Yes, I considered doing an explicit SET PATH in startup, but settled on the File Locations. The main reason was for the building process, so that all of the related components & code could be found.



Thanks Mark, Chris & Mike.

 
Mr. (or Miss) VBSExplorer

- What a funny alias when you are exploring VFP -

If you have a situation where you have numerous directories in your patch you can consider to make a following statement:

Code:
*** here we make two different pathsettings:  one for development  and one for production:
lcPath = ''
If Version(2) # 0
	***  We are in Development Mode
	***  Set up Project search path
	m.lcPath = Home() + ';' + Fullpath( Curdir() ) + [;Classes;  Forms ; Otherfiles ; Otherfiles\Others ; 
	Otherfiles\Others\Icons;  Progs ; Otherfiles\Menu ; Otherfiles\Textfiles ; Reports; ReportingFiles]

Else
	*** We are in Production Mode
	*** Set up application search paths
	m.lcPath = Fullpath( Curdir() ) + [ ;reports ; ReportingFiles]
Endif

Set Path To ( m.lcPath ) additive

This should work, place it in your projects main.prg

Stay healthy,
Koen
 
Thanks Koen,

I'll take a look at this, after I'm able to get a Build going.


"What a funny alias when you are exploring VFP"

That's cause I originally opened my Tek-Tips account, when I was given a VBScript project to work on.


T & R,


 
I originally opened my Tek-Tips account, when I was given a VBScript project to work on

But you can change your "display name" at any time, without it affecting your Tek-Tips login. In fact, it's considered polite for forum members to use actual names rather than meaningless aliases. For example, Mike Lewis or Nigel Gomm or Chris Miller. It doesn't have to be your real name - witness, for example, Griff. But it's nice if it's a name that you can be addressed by. It makes the whole thing more friendly and personal.

If you care to do that, click My Stuff at the top right of this page, then select My Profile. Of course, it's not compulsory.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Ok, thanks Mike. Obviously, it's not a priority, so I'll just hold off. Besides, I still support some VBScript projects, and might ask question in the future.

Maybe I'll change it to something more generic.

Anyway, thanks for letting me know.

 
it's not a priority, so I'll just hold off ... Maybe I'll change it to something more generic.

That's fine. You're right that it's not a priority. It certainly won't affect the help that you get in the forum.

But, just to be clear: the aim is not to make the name generic, but rather to make it personal. It's simply more natural to address people as Chris or Nigel or Tamar, rather than using some contrived string. If you prefer to remain anonymous, that's fine too: you can always use a nickname or pseudonym.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top