>Ed, your suggestion raises a question I've been meaning to ask someone: I used to use a launcher just like this for apps written in FPDOS 2.x, but it's my understanding that in VFP the code doesn't stop while the COPY FILE is running, meaning the DO .\MyApp.EXE will fire well before the new copy of the EXE is really there. But, I have not tested this with VFP, have you?
It does indeed work; I don't use the internal COPY FILE, however - I use the API CopyFile() call in my production code, along with other API calls to set file attributes and correctly update the date/time stamp on the copied file.
>
> I guess one answer is to ERASE .\MyApp.EXE just before the COPY FILE, then put the DO .\MyApp.EXE inside a loop which checks for the presence of .\MyApp.EXE before issuing the DO. What do you think?
>
A better test would be to try to FOPEN() .\MyApp.EXE in Read/Write mode; the copy will definitely have completed when you succeed. Again, the code snippet that I put up is not what i do for my production launcher; it's just a stepping stone for someone else to look at for ideas.
>>>...snip...
>
>>One common approach is to use a launcher application. A launcher is a fixed piece of code that starts up your app; it can, before starting your local copy of your executable, check the date/time stamp of your local copy of the application against the date/time stamp of an executable stored on the net; if the one on the net is more recent, it gets copied to the local machine and then launched. A simple example here - let's assume that the local copy that I want to fire at all times is stored in the CWD that my app launcher starts from and is called MYAPP.EXE, and that the most recent released copy of the executable is always available on the net at \\MyServer\MyAppDist\MYAPP.EXE; you could in your launcher do the following:
>>
>>
>>* some code probably precedes this
>
>>LOCAL aMyLocalCopy[1,5], aTheNetCopy[1,5]
>>IF FILE('.\MyApp.EXE')
>> * I have a copy, check if it's the most recent one
>> =ADIR(aMyLocalCopy,'.\MyApp.EXE')
>> =ADIR(aTheNetCopy,'\\MyServer\MyAppDist\MyApp.EXE')
>> IF DTOS(aTheNetCopy[1,3])+aTheNetCopy[1,4] > DTOS(aMyLocalCopy[1,3])+ aMyLocalCopy[1,4]
>> * Net copy is more recent
>> COPY FILE \\MyServer\MyAppDist\MyApp.EXE TO .\MyApp.EXE
>> ENDIF
>>ELSE
>> COPY FILE \\MyServer\MyAppDist\MyApp.EXE TO .\MyApp.EXE
>>ENDIF
>>DO .\MyApp.EXE
>
>>
>>
>>Obviously, you can do more in the launcher app and generalize things, but this makes an interesting starting point.