I'm About to Give Up on InnoScript - Part 2

Started by Randem, December 22, 2007, 10:34:58 AM

Previous topic - Next topic

Tom Buggy

Oh Boy!  The problem was not with the file copy code (although the adaptation of your project code is simpler and I'm now using it).
 
The problem had to do with where the GHM.EXE file is being sourced in the script.  The Search Paths in the script include the location of the PDW Package files (where I have the default databases) and GHM.EXE is being sourced from that location.  After I modified the app and recompiled to include the code for the files copy from GHMCONV I didn't run the PDW to place GHM.EXE in the Package files.  Therefore, Setup was installing an old version of the app that did not contain the files copy code (Duh!).
 
Although I've resolved the problem by running the PDW, I want to change the script to source  GHM.EXE from the VB folder so I won't have to run the PDW to get the latest version of GHM.EXE in the PDW Package files.  I tried to add the new sourcing to my template but two Source items for the file were generated - my template addition from the VB folder and the original source from the PDW Package files.  Apparently the inclusion of the Package files folder in Search Files is taking precedence.  I suppose I can just source the other files I need from a folder outside of the PDW Package files, eliminate the PDW Package files folder from Search Files, and add the VB folder to Search Files.

Randem

I think you are over-complicating matters. In the code project I posted there is a simply few lins of code that copies whole folders. It can easily be modified for you situation. All of our apps use it with no failures...

Tom Buggy

I checked the clean Virtual PC XP machine.  The only place where the .DAT files are present after installing and running the app is the GHMCONV folder where they are to be sourced from in the app's GetFile statements.  For whatever reason they are not being copied by the fil.Copy statements.  No error is reported on the statements.  The app runs to a point where it repors that a file that is supposed to be in the AppDataPath folder isn't there.
 
BTW, while trying to resolve this situation AppDataPath is hard-coded as C:Documents and SettingsAll UsersApplication DataGHMDATA.  And that's where the files get copied to when I run from the IDE.

Randem

BTW: Thats a lot of overhead when a simple FileCopy Statement will do. Beside the FileCopy command doesn't need all the overhead of the Scripting Runtimes...

Tom Buggy

Yes, the first-run code is in the app and the code snippet I posted is app code being used to copy the files.  Dltr is a variable that contains the Hard Drive letter - e.g. C:.  I create it from the first two characters of App.Path.
 
I'll check for the files in other places but the GetFile and fil.Copy statements are explicit - they include the Drive and Folder for both the source folder/file and the AppDataPath.

Randem

Also in your code:
 
 fil.Copy (AppDataPath & GHM_V70.DBF), True
 
should be
 
 fil.Copy (AppDataPath & GHM_V70.DBF, True)
 
How did you get away with this? Do you have Option Explicit at the top of each form/module/class? The way you did it Overwrite is possibly False...

Tom Buggy

I guess for upgrade users I could source in the script the database files and the .DAT files from the GHMCONV folder and not include the default database files.  That would mean I'd need separate Setups for new users and upgrade users.  However, I'm wondering why the first-run code works in the IDE and not after the install with the present Setup.

Randem

Is your first run code in your app? The code you posted is the code you use to attempt to copy the file?
 
What is Dltr?
 
It would seem that you are coping the file to another location. Check for that. That can happen if the current folder changes. You are not where you think you are when you try to copy.

Tom Buggy

I assume you mean your application copies the files to the correct location? -- Yes
 
Which files are we talking about? -- The user's real database files (such as GHM_V70.DBF) that are to replace the skeleton .DBF's) and a few .DAT files that contain user specifications such as options used, course definitions, etc.
 
Isn't this what you want? What else do you want there? -- For new users that's all I want.  For upgrade users (which is this case) I want to replace the default database files and add the .DAT files.  The first-run code is only used for upgrade users.
 
Script is attached.

Randem

When I run on my development machine out of the IDE everything is fine - all the files get to the app's data folder as desired.
 
I assume you mean your application copies the files to the correct location?
 
However, when I use the Inno Setup program to install on the Virtual PC XP machine or my development machine, the files don't get to the app's data folder
 
Which files are we talking about?
 
only the default database files placed there by Setup are present.
 
Isn't this what you want? What else do you want there?
 
 
I would need to see your script...

Tom Buggy

Okay - I've compiled your project and run it on my development machine, the Virtual PC XP machine and the Vista machine.  Neat!  I intend to use it in the near future.  In the meantime I have a nagging problem that I hope you can help with.
 
As I've mentioned, for upgrade users I have first-run code in the app to place their data files in the app's data folder.  This includes overwriting the default database files installed by Setup and copying some other data files that are in a folder (GHMCONV) that has been created and filled by conversion code in the old app.  I am a using File System Object as illustrated by the following code snippet:
 
If FCfso.FolderExists(Dltr & GHMCONV) = False Then
      MsgBox 'Error Msg conversion task not done in old version
      Exit Sub
   Else
      Set fldr = FCfso.GetFolder(Dltr & GHMCONV)
               Set fil = FCfso.GetFile(fldr & GHM_V70.DBF)
         fil.Copy (AppDataPath & GHM_V70.DBF), True
.
.
.
End If
 
The two GetFile and fil.Copy statements are repeated for the remaining files.
 
Here's the problem.  When I run on my development machine out of the IDE everything is fine - all the files get to the app's data folder as desired.  However, when I use the Inno Setup program to install on the Virtual PC XP machine or my development machine, the files don't get to the app's data folder - only the default database files placed there by Setup are present.  What could be causing this?


Tom Buggy


Randem

At least compile the project and run it on both your XP and Vista systems to see what I am talking about.
 
implementing it into your app would be basically a no brainier...

Tom Buggy

BTW, now that I've clearly established that I have a fallback, I AM going to see if I can understand how to apply and use your code.