Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

File copied at the bad place


2 replies to this topic

P-Y Orban

P-Y Orban
  • Full Members
  • 10 posts

Posted 09 August 2007 - 08:53

Hi all,

In my script, I will seek on diskette (a:) if the file license is there.

If it is there, I copy this file in the installation directory (directory previously chosen by the user).

However my problem is that my script copies my file in the folder containing the installor (Setup.exe) ><

Here the part of code which copies my file:

CODE

 // Copier le fichier tee_pso.lic
 CopyPasswordFile:
    bPasswdInstall = FALSE;
    retBox = AskYesNo("Do you want to install the license file ?", YES);
    if (retBox) then
       szSrcDir = SRCDIR;
       strResult = "A:";
       if (GetSystemInfo(DRIVE, nvResult, strResult)=0) then
          if (nvResult=IS_REMOVABLE) then
             szMsg = "Put the 'Password' floppy disk in drive A:\n          and click on the 'Ok' button";
             MessageBox(szMsg, INFORMATION);
             TARGETDIR = svMainDirectory;
             SRCDIR = "A:";
         
             // Chercher le 'ComputerName'
             RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
             szRegKey = "SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName";
             szName = "ComputerName";
             RegDBGetKeyValueEx(szRegKey, szName, nvType, svValue, nvSize);
             
             // Construire le nom du fichier de licence
             passwordfilename = "tee_pso_" + svValue + ".lic";
             fullpasswordfilename = SRCDIR ^ passwordfilename;
             
             #ifdef DEBUG
                szMsg = "Fichier de licence recherché : " + passwordfilename + "\n\n";
                MessageBox(szMsg, INFORMATION);
             #endif
             
             if (GetFileInfo(fullpasswordfilename, FILE_SIZE, nvResult, szResult)<0) then
                szMsg = "Can't find '" + passwordfilename + "' on floppy disk\n\n";
                szMsg = szMsg + "  -> You will have to copy it manually\n\n";
                MessageBox(szMsg, WARNING);
                goto DisplayEndMessage;
             else
               
                // svLicenseDirectory = "C:\Program Files\TEE_PSO\Flexlm\tee_pso.lic";
                retBox = CopyFile(passwordfilename, "tee_pso.lic");
                if (retBox<0) then
                   szMsg = "Unable to copy '" + fullpasswordfilename + "' to " + TARGETDIR;
                   #ifdef DEBUG
                     NumToStr(szTemp, retBox);
                     szMsg = szMsg + "  Code d'erreur " + szTemp + " \n\n";
                   #endif
                   MessageBox(szMsg, SEVERE);
                   abort;
                endif;
                bPasswdInstall = TRUE;
             endif;
          endif;
       endif;
       SRCDIR = szSrcDir;
    endif;
 
 
 DisplayEndMessage:
    // If shared files could not be installed, then users must restart system.
    if (BATCH_INSTALL) then
       szMsg = "Some files could not be installed because they are " +
               "currently in use by other programs in the system.  " +
               "To allow for proper operation of the new program you should restart" +
               "your system at this time.";
       CommitSharedFiles(0);
       RebootDialog("Restart Windows", szMsg, SYS_BOOTMACHINE);
    else
       szMsg = "Setup is complete.\n\n\n";
 
       // Message pour Windows NT
       if (!bPasswdInstall) then
         svMainDirectory = TARGETDIR;
          szMsg = szMsg + "Don't forget to copy the license file tee_pso.lic\n";
          szMsg = szMsg + "  to the FLEXlm directory '" + svMainDirectory + "'\n\n";
       endif;
    endif;
 
    MessageBeep(0);
    MessageBox(szMsg, INFORMATION);


Thank's for your answers !

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 09 August 2007 - 19:46

Try with INSTALLDIR instead of TARGETDIR. If that doesn't help, try setting it immediately before your CopyFile call. And display its value in a MessageBox. If that still doesn't help try specifying the full path in the second parameter to CopyFile.

P-Y Orban

P-Y Orban
  • Full Members
  • 10 posts

Posted 10 August 2007 - 07:54

Thank's Stefan,

Finally, I solved my problem smile.gif