copy file (tcSourceFile) to (tcDestinationFile)
and, as I said, at the time of the error tcSourceFile =
"C:\DEV\VISUAL\COMMON\FORMS\LOGIN.SCT".
It's a strange one. Anybody have any thoughts on this?
Thanks,
Russell Campbell
You're falling afoul of something wierd!
The Fox WIki says at http://fox.wikis.com/wc.dll?Wiki~VFPFileSearchPath~VFP
that it really isn't clear.
http://fox.wikis.com/wc.dll?Wiki~VisualFoxproInvocationStack gives a hint of
what might be happening.
All things considered (functions and class definitions), VFP searches :
1.. Internal commands ( if the function is not prefixed with m.) and base
classes, then
2.. User-defined class definitions cached in memory in the order they were
loaded, so long as the class definitions are still along SET CLASSLIB or SET
PROCEDURE, then
3.. If in VFP 8, a collection's default method, for example
myCollection(), then
4.. MyArray(n) array memory variable in scope.
5.. Functions and class definitions in the current .PRG, then
6.. Class definitions along SET CLASSLIB, then
7.. Functions and class definitions along SET PROCEDURE, then
8.. Functions and class definitions in the stored procedures of the
current SET DATABASE TO, then
9.. Functions and class definitions in the execution chain (call stack),
then
10.. Functions named for files bound in the app/exe, then
11.. Functions named for files in the SET DEFAULT (local) directory, then
12.. Functions named for files out along SET PATH.
13.. COM classes in the OLE registry if SET OLEOBJECT is ON
So I think for a file, your search will be in 10, then 11, then 12.
But that should only apply when the filename alone is specified and there is
ambiguity that needs to be resolved.
Once a full path to the file is passed, then that ought to bypass all of
this searching.
Example:
I have a form with a cmdButton that does this:
COPY FILE 'c:\temp\zort\runtime\zort.zzz' to 'h:\zort.zzz'
The file zort.zzz is embedded into the exe from c:\temp\zort\dev\zort.zzz.
The two zort.zzz files have different contents. If I do the COPY FILE above
from the EXE you would expect the runtime\zort.zzz file to end up on the H:
drive. But, surprise, VFP takes the embedded dev\zort.zzz file instead!!! It
completely ignores the path in the source file parameter, and doesn't care
if the file exists or not. It uses the embedded file.
To make matters more confusing, before it copies the embedded file, it first
verifies that the disk file that was the source of the embedded file exists.
It won't use this file, it just verifies that it exists. That is why you get
the error - it can't find the file in the path that it was embedded from,
again ignoring the path you gave it in the source parameter.
So:
1) we copy from source to destination.
2) source file is embedded into EXE
3) VFP will verify the physical existence of source file on disk, but not
actually copy it.
4) VFP will copy contents of embedded file, ignoring file specified in
source parameter.
Is this a bug? It's been a problem since VFP3 and I would not be surprised
to find that FPW did the same thing. Bug or Feature By Design, it is
extremely unreliable to use COPY FILE on any files that are embedded in the
EXE, regardless of the path.
You might want to examine some of the files that you have copied to ensure
that their contents are what you expect them to be, and not the contents of
the embedded file.
YMMV.....
"Russell Campbell" <nos...@byteme.com> wrote in message
news:45J5b.29753$Om1....@newsread2.news.atl.earthlink.net...
"PAul Maskens" <pmas...@mvps.org> wrote in message
news:e5Xh9Vwc...@TK2MSFTNGP09.phx.gbl...
Thanks for all the info.
"Ook" <usenet@nospam@emberts.com> wrote in message
news:OPQpTZwc...@TK2MSFTNGP09.phx.gbl...
I just spent some time playing with FoxPro 2.6, and it has the same problem.
Different versions of FoxPro may or may not give an error if the file
doesn't exist on disk, but it looks like they all will use the embedded
file, ignoring the path specified in the source file parameter.
"Russell Campbell" <nos...@byteme.com> wrote in message
news:fNM5b.23184$EW1....@newsread1.news.atl.earthlink.net...
"Ook" <usenet@nospam@emberts.com> wrote in message
news:uFyg1ayc...@TK2MSFTNGP10.phx.gbl...
I suspect that DO FORM... is translated behind the scenes to an actual
JUMP...or maybe it's not that easy, and is more complex then that? Hmm...I'm
going to get in over my head, so I'll stop guessing and maybe someone who
knows more about how the APP/EXE works can jump in and comment.
"Russell Campbell" <nos...@byteme.com> wrote in message
news:q0R5b.32762$Om1....@newsread2.news.atl.earthlink.net...