Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing current directory and relative path
Message
De
03/11/2010 14:49:14
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01488018
Message ID:
01488042
Vues:
66
This message has been marked as a message which has helped to the initial question of the thread.
>>>>It sounds like you should be using absolute paths.
>>>
>>>No, the paths should remain the same as they were.
>>>
>>>In other words, when I change the directory, the program no longer sees the procedures that are in the Progrs directory of the project.
>>
>>I'm completely confused now. I thought you said the problem was that the relative paths weren't working when you change dthe current directory and you wanted them to work. Could you explain with an example, please?
>
>When I'm switching between applications, I run this program:
>
>
>SET PATH TO CLASS LIBS,FORMS,GRAPHICS,MENUS,PROGRAMS,REPORTS,;
>  VFP LIBRARY\SHARED CLASS LIBS,VFP LIBRARY\SHARED FORMS,VFP LIBRARY\SHARED PROGRAMS,;
>  VFP LIBRARY\SHARED HEADER FILES,VFP LIBRARY\SHARED MENUS,VFP LIBRARY\SHARED REPORTS, ;
>  VFP LIBRARY\SHARED GRAPHICS
>
>
>so, I then can run the main program of the application and it will find all necessary programs.
>
>In one of my programs I need to change a directory to a different directory
>
>set default to (lcNewDir)
>
>after that the program does not see my programs. I want to be able to still test my programs in IDE and keep this program if possible (or somehow adjust it as I run it before I start working with every project).


That still sounds to me like you need to use absolute paths. So your SET PATH should be:

SET PATH TO < my full path>\CLASS;< my full path>FORMS

and so on. You could probably code it like this:
m.lcOldPath = SET("PATH")
m.lcNewPath = ""
m.lnPaths = ALINES(laPaths, m.lcOldPath,1, ",")

m.lcCurDir = CURDIR() && or whatever you want

FOR m.lnCount = 1 TO m.lnPaths
	m.lcNewPath = m.lcNewPath + ADDBS(m.lcCurDir) + laPaths[m.lnCount] + IIF(m.lnCount < m.lnPaths, ",", "")
ENDFOR

?m.lcNewPath

CD < new directory >

SET PATH TO (m.lcNewPath) && or macro subs if necessary
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform