Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing current directory and relative path
Message
From
03/11/2010 15:56:33
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01488018
Message ID:
01488072
Views:
58
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>I'm using relative paths in the development. I have code that changes the current directory and then all my relative paths don't work anymore.
>
>Is there a method to fix the probem (still use the relative paths, but allow changing of the main directory)?

If you're setting your paths at startup, convert them to absolute at that point... like this:
	Do addpath With 'libs'
	Do addpath With 'frx'
	Do addpath With 'forms'
	Do addpath With 'tools'
	Do addpath With 'stuff'
...

Proc addpath
	Lparam cPath
	Try
		cPath=FullPath(Addbs(cPath))

		If Directory(cPath)
			If Atc(cPath+',', Set('path')+',')=0
				cPath=Set('path')+','+cPath
				Set Path To (cPath)
			Endif
		Endif
	Catch To oEx
		Assert .F. Message oEx.Message
	Endtry

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform