Path to files in a project? 
Author Message
 Path to files in a project?

I have all my forms, code, and data in a project, and I'm confused about
what the value of "the project", i.e. the Project Manager, itself is.  I
figured if the files are all identified within the project, when I call
DO FORM, I shouldn't have to qualify the file path-wise.  This turns out
to be wrong, as sometimes a form gets called and an error dialog comes up
that the file doesn't exist (in another directory).  And if I take the
extra step of SET PATH and SET DEFAULT at the beginning, I'll need to
change those paths in the production version, which is also a pain.

So you could say, just address everything relatively (I have forms, prgs,
etc., all in their own subdirectories) and do SET PATH or SET DEFAULT one
time.  I suppose that could work, but I'm also unclear on exactly WHAT is
needed in that regard once I compile the thing into an EXE.  I believe
that all PRG's and SCX's are compiled INTO the exe, while DBC's and
DBF's, indexes, etc., are NOT.  Is that right?  IOW, the path to forms
and programs, once it's a compiled version, is not important any more, as
long as the Project Manager knows where everything is at compilation
time.

I'd appreciate any clarification on these issues, and advice as to how
people generally organize their files in a project and handle path
issues.  Thanks much in advance.

------
Michael



Wed, 31 Aug 2005 01:18:00 GMT  
 Path to files in a project?
You're right on every point.
If the Project files are in the project root it can handle all the relative
addressing.
I SET DEFAULT TO JUSTPATH(_VFP.SERVERNAME) and build path this way
LOCAL lnN, aTemp(1), lcPath
lcPath = ''
lnN=0
lnN = ADIR (aTemp,'*.','D')
FOR i = 1 TO m.lnN
 IF LEFT(aTemp(i,1),1) <>'.'
  lcPath = lcPath+aTemp(i,1)+';'
 ENDIF
NEXT
SET PATH TO &lcPath
-Anders


Quote:
> I have all my forms, code, and data in a project, and I'm confused about
> what the value of "the project", i.e. the Project Manager, itself is.  I
> figured if the files are all identified within the project, when I call
> DO FORM, I shouldn't have to qualify the file path-wise.  This turns out
> to be wrong, as sometimes a form gets called and an error dialog comes up
> that the file doesn't exist (in another directory).  And if I take the
> extra step of SET PATH and SET DEFAULT at the beginning, I'll need to
> change those paths in the production version, which is also a pain.

> So you could say, just address everything relatively (I have forms, prgs,
> etc., all in their own subdirectories) and do SET PATH or SET DEFAULT one
> time.  I suppose that could work, but I'm also unclear on exactly WHAT is
> needed in that regard once I compile the thing into an EXE.  I believe
> that all PRG's and SCX's are compiled INTO the exe, while DBC's and
> DBF's, indexes, etc., are NOT.  Is that right?  IOW, the path to forms
> and programs, once it's a compiled version, is not important any more, as
> long as the Project Manager knows where everything is at compilation
> time.

> I'd appreciate any clarification on these issues, and advice as to how
> people generally organize their files in a project and handle path
> issues.  Thanks much in advance.

> ------
> Michael



Wed, 31 Aug 2005 04:40:10 GMT  
 Path to files in a project?

Quote:

> You're right on every point.
> If the Project files are in the project root it can handle all the relative
> addressing.

I don't think that's what he asked Anders.  I think he's saying that,
regardless of your development directory structure, don't all the files get
compiled into the app/exe, so they're not anywhere else in the directory
structure at all, they're right there in the file that's running, so does
there need to be any path considerations given, except there seem to be.  Not
sure if I'm correctly translating here or just recounting my own questions on
the subject.

Regards
Mark



Wed, 31 Aug 2005 23:34:20 GMT  
 Path to files in a project?
Hi Michael!

Quote:
> that the file doesn't exist (in another directory).  And if I take the
> extra step of SET PATH and SET DEFAULT at the beginning, I'll need to
> change those paths in the production version, which is also a pain.

Take a look at SYS(16).
And modify it in dependence of _VFP.startmode.

example:
...\myproject\myproject.pjx
...\myproject\myproject.exe
...\myproject\programs\main.prg

in main.prg:

IF _vfp.startmode<4
    lcPathtoproject = STRTRAN(SYS(16),"programs\main.prg","")
ELSE
    lcPathtoproject = STRTRAN(SYS(16),"myproject.exe","")
ENDIF

SET PATH TO (lcPathtoproject),...

Bye, Olaf.



Fri, 02 Sep 2005 01:19:37 GMT  
 Path to files in a project?
Is there a reason you wouldn't use JUSTPATH(SYS(16))?

--

Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.

Quote:

> Hi Michael!

>> that the file doesn't exist (in another directory).  And if I take
>> the extra step of SET PATH and SET DEFAULT at the beginning, I'll
>> need to change those paths in the production version, which is also
>> a pain.

> Take a look at SYS(16).
> And modify it in dependence of _VFP.startmode.

> example:
> ...\myproject\myproject.pjx
> ...\myproject\myproject.exe
> ...\myproject\programs\main.prg

> in main.prg:

> IF _vfp.startmode<4
>     lcPathtoproject = STRTRAN(SYS(16),"programs\main.prg","")
> ELSE
>     lcPathtoproject = STRTRAN(SYS(16),"myproject.exe","")
> ENDIF

> SET PATH TO (lcPathtoproject),...

> Bye, Olaf.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.462 / Virus Database: 261 - Release Date: 3/13/2003


Fri, 02 Sep 2005 01:40:03 GMT  
 Path to files in a project?
Hi Fred!

Quote:
> Is there a reason you wouldn't use JUSTPATH(SYS(16))?

I'd get
...myproject\programs\
or
...myproject\
depending on startmode, but I always want
to get ...myproject\!

In my project folders the main.prg file and the compiled exe
will not be in the same folder! I could of course compile the
exe to the programs folder or put the main.prg into the project
folder, but I don't want to.

I could of course start with JUSTPATH(SYS(16)) and
remove the pograms folder from that afterwards... there
are always more ways to do things, some being more
elegant...

In fact I don't use STRTRAN but RAT('\',1) or RAT('\',2) in
a SUBSTR-Call. But I thought STRTRAN would make the
concept of getting a path to the project more transparent.

If you have that path to the project, you can generate the
paths to the programs, classes, forms etc. folder starting
from the project path.

Bye, Olaf.

Quote:
> > Take a look at SYS(16).
> > And modify it in dependence of _VFP.startmode.

> > example:
> > ...\myproject\myproject.pjx
> > ...\myproject\myproject.exe
> > ...\myproject\programs\main.prg

> > in main.prg:

> > IF _vfp.startmode<4
> >     lcPathtoproject = STRTRAN(SYS(16),"programs\main.prg","")
> > ELSE
> >     lcPathtoproject = STRTRAN(SYS(16),"myproject.exe","")
> > ENDIF

> > SET PATH TO (lcPathtoproject),...

> > Bye, Olaf.



Fri, 02 Sep 2005 02:52:03 GMT  
 Path to files in a project?
Hi Olaf,

Ah, now I see the subtle difference.

--

Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.

Quote:

> Hi Fred!

>> Is there a reason you wouldn't use JUSTPATH(SYS(16))?

> I'd get
> ...myproject\programs\
> or
> ...myproject\
> depending on startmode, but I always want
> to get ...myproject\!

> In my project folders the main.prg file and the compiled exe
> will not be in the same folder! I could of course compile the
> exe to the programs folder or put the main.prg into the project
> folder, but I don't want to.

> I could of course start with JUSTPATH(SYS(16)) and
> remove the pograms folder from that afterwards... there
> are always more ways to do things, some being more
> elegant...

> In fact I don't use STRTRAN but RAT('\',1) or RAT('\',2) in
> a SUBSTR-Call. But I thought STRTRAN would make the
> concept of getting a path to the project more transparent.

> If you have that path to the project, you can generate the
> paths to the programs, classes, forms etc. folder starting
> from the project path.

> Bye, Olaf.

>>> Take a look at SYS(16).
>>> And modify it in dependence of _VFP.startmode.

>>> example:
>>> ...\myproject\myproject.pjx
>>> ...\myproject\myproject.exe
>>> ...\myproject\programs\main.prg

>>> in main.prg:

>>> IF _vfp.startmode<4
>>>     lcPathtoproject = STRTRAN(SYS(16),"programs\main.prg","")
>>> ELSE
>>>     lcPathtoproject = STRTRAN(SYS(16),"myproject.exe","")
>>> ENDIF

>>> SET PATH TO (lcPathtoproject),...

>>> Bye, Olaf.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.462 / Virus Database: 261 - Release Date: 3/13/2003


Fri, 02 Sep 2005 02:52:05 GMT  
 Path to files in a project?
Michael,

SET PATH should become more or less moot inside your exe, it's used at
design time so that you can easily test components with a simple DO FORM
command or just a click of the ! button. Building the EXE will bundle all of
the non-excluded files of the project into the EXE file, at runtime this is
the first place VFP looks to find something that is called to run.

If you set your paths up consistently and relatively then it becomes a
simple CD to any given project's directory and everything just works. My SET
path looks something like:

..\; - global stuff lives one level up
.\; - explicit reference to the current folder
.\forms\;.\menus\;.\code\;.\reports\; - all of the code for each projects
sits in subfolders

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro


Quote:
> I have all my forms, code, and data in a project, and I'm confused about
> what the value of "the project", i.e. the Project Manager, itself is.  I
> figured if the files are all identified within the project, when I call
> DO FORM, I shouldn't have to qualify the file path-wise.  This turns out
> to be wrong, as sometimes a form gets called and an error dialog comes up
> that the file doesn't exist (in another directory).  And if I take the
> extra step of SET PATH and SET DEFAULT at the beginning, I'll need to
> change those paths in the production version, which is also a pain.

> So you could say, just address everything relatively (I have forms, prgs,
> etc., all in their own subdirectories) and do SET PATH or SET DEFAULT one
> time.  I suppose that could work, but I'm also unclear on exactly WHAT is
> needed in that regard once I compile the thing into an EXE.  I believe
> that all PRG's and SCX's are compiled INTO the exe, while DBC's and
> DBF's, indexes, etc., are NOT.  Is that right?  IOW, the path to forms
> and programs, once it's a compiled version, is not important any more, as
> long as the Project Manager knows where everything is at compilation
> time.

> I'd appreciate any clarification on these issues, and advice as to how
> people generally organize their files in a project and handle path
> issues.  Thanks much in advance.

> ------
> Michael



Fri, 02 Sep 2005 03:04:39 GMT  
 Path to files in a project?
That doesn't work for me, as I get this long name of the calling program,
which could include the form name, button name, and event handler name
before I even get to the path.  I wind up searching for a ":" and backing
up a character.

-mk

Quote:

> Is there a reason you wouldn't use JUSTPATH(SYS(16))?



Mon, 12 Sep 2005 08:49:59 GMT  
 Path to files in a project?
I'm with you on your directory structure, but you know, when I deploy the
EXE, I don't have all those sub-folders.  Then I have to do a check of
_VFP.StartMode to see am I running Production or Development?

-mk

Quote:

> Michael,
> SET PATH should become more or less moot inside your exe, it's used at
> design time so that you can easily test components with a simple DO
> FORM command or just a click of the ! button. Building the EXE will
> bundle all of the non-excluded files of the project into the EXE file,
> at runtime this is the first place VFP looks to find something that is
> called to run.

> If you set your paths up consistently and relatively then it becomes a
> simple CD to any given project's directory and everything just works.
> My SET path looks something like:

> ..\; - global stuff lives one level up
> .\; - explicit reference to the current folder
> .\forms\;.\menus\;.\code\;.\reports\; - all of the code for each
> projects sits in subfolders



Mon, 12 Sep 2005 08:52:23 GMT  
 Path to files in a project?
right.
set have to set your path in the IDE to locate all files, but for the exe ,
you only need to set the path for files that are excluded from the exe.
the files included within the exe will always be found regardless of the
path.


Quote:
> I'm with you on your directory structure, but you know, when I deploy the
> EXE, I don't have all those sub-folders.  Then I have to do a check of
> _VFP.StartMode to see am I running Production or Development?

> -mk


> > Michael,
> > SET PATH should become more or less moot inside your exe, it's used at
> > design time so that you can easily test components with a simple DO
> > FORM command or just a click of the ! button. Building the EXE will
> > bundle all of the non-excluded files of the project into the EXE file,
> > at runtime this is the first place VFP looks to find something that is
> > called to run.

> > If you set your paths up consistently and relatively then it becomes a
> > simple CD to any given project's directory and everything just works.
> > My SET path looks something like:

> > ..\; - global stuff lives one level up
> > .\; - explicit reference to the current folder
> > .\forms\;.\menus\;.\code\;.\reports\; - all of the code for each
> > projects sits in subfolders



Mon, 12 Sep 2005 12:12:40 GMT  
 Path to files in a project?
Michael,

I basically only use the Tools/Options/File Locations dialog to set my path
for dev, I never change it. Every project uses the same directory structure.
I don't put a SET PATH into the any of the actual code. There are other
things that I use version() or _vfp.StartMode to detect the running mode and
control some features like error handling etc.

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro


Quote:
> I'm with you on your directory structure, but you know, when I deploy the
> EXE, I don't have all those sub-folders.  Then I have to do a check of
> _VFP.StartMode to see am I running Production or Development?



Mon, 12 Sep 2005 23:43:29 GMT  
 Path to files in a project?
Hi David,

I missed the previous messages of this thread, so my question is not related
to the previous message.  However, it seems related to my question, I just
post a new message in this ng concerning "set path" and "set default".
For developing situation, file location is absolutely under our control. But
for deploying the program, the path of  data file may be varied.  As my
general practice, I will use a config.fpw file to set default and path to
the data directory using network mapping drive.  However, the program cannot
locate the map drive sometimes, the user must map the network drive again.
Is there any way that I can set path to the network drive using URL path ?

Matthew



Quote:
> Michael,

> I basically only use the Tools/Options/File Locations dialog to set my
path
> for dev, I never change it. Every project uses the same directory
structure.
> I don't put a SET PATH into the any of the actual code. There are other
> things that I use version() or _vfp.StartMode to detect the running mode
and
> control some features like error handling etc.

> --
> df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro



> > I'm with you on your directory structure, but you know, when I deploy
the
> > EXE, I don't have all those sub-folders.  Then I have to do a check of
> > _VFP.StartMode to see am I running Production or Development?



Tue, 13 Sep 2005 13:07:44 GMT  
 Path to files in a project?
Matthew,

Your app is always going to have to contend with network resources if it
uses them. Users can unmap or change mappings. You can use UNC
\\machine\drive\directory but then you are subject to machine name changes.
Your app needs to be able to detect these sort of problems and allow
configuration changes. You can use INI files, registry entries or a local
config.dbf.

I think it's best to use the current directory (remember the user can
specify a start in directory on shortcuts) and sys(16) to detect where the
exe is being launched from to find the local external files your app needs.

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro


Quote:
> Hi David,

> I missed the previous messages of this thread, so my question is not
related
> to the previous message.  However, it seems related to my question, I just
> post a new message in this ng concerning "set path" and "set default".
> For developing situation, file location is absolutely under our control.
But
> for deploying the program, the path of  data file may be varied.  As my
> general practice, I will use a config.fpw file to set default and path to
> the data directory using network mapping drive.  However, the program
cannot
> locate the map drive sometimes, the user must map the network drive again.
> Is there any way that I can set path to the network drive using URL path ?



Tue, 13 Sep 2005 22:52:56 GMT  
 Path to files in a project?
Hi David,

I have solved the path problem in using UNC address, as Eric in another
thread point out that the path should be set to the server-name and
share-directory, not to the domain-name and directory.
The ideas you have mentioned is great help to me too, I will look at it.

Thanks.

Matthew



Quote:
> Matthew,

> Your app is always going to have to contend with network resources if it
> uses them. Users can unmap or change mappings. You can use UNC
> \\machine\drive\directory but then you are subject to machine name
changes.
> Your app needs to be able to detect these sort of problems and allow
> configuration changes. You can use INI files, registry entries or a local
> config.dbf.

> I think it's best to use the current directory (remember the user can
> specify a start in directory on shortcuts) and sys(16) to detect where the
> exe is being launched from to find the local external files your app
needs.

> --
> df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro



> > Hi David,

> > I missed the previous messages of this thread, so my question is not
> related
> > to the previous message.  However, it seems related to my question, I
just
> > post a new message in this ng concerning "set path" and "set default".
> > For developing situation, file location is absolutely under our control.
> But
> > for deploying the program, the path of  data file may be varied.  As my
> > general practice, I will use a config.fpw file to set default and path
to
> > the data directory using network mapping drive.  However, the program
> cannot
> > locate the map drive sometimes, the user must map the network drive
again.
> > Is there any way that I can set path to the network drive using URL path
?



Fri, 16 Sep 2005 09:16:08 GMT  
 
 [ 17 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Getting Long File Path from short Path / File Name

2. Network path to UNC path?

3. Path error creating text files

4. file path length?

5. Control / Class to Select a File or Path on My Computer

6. invalid path or file name

7. Class file (path) not found

8. FOPEN() a file on a UNC path ...

9. ??Fill the array with files and their paths form all directories

10. COM Object Error: Invalid Path or File Name

11. Error Loading Config File=bad path?

12. the file name with out the full path and extension

 

 
Powered by phpBB® Forum Software