Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2006
    Posts
    345

    Grin File.Copy versus File.Install ....

    when transfering files from your project to a system, where 99% of the time the files will already exist, which is the better / correct action to use.

    i need to be 100% sure that the files are over-written/replaced.

    i see the File.Install action has a backup file option, does this rename the existing file allowing a clear route for then transferring the new file in, or does it create a copy of the original file and rename it, meaning that the action must still over-write the original file ?

    backing up the file for my use is not realy required, and could result in redundant files being left all over the place, not good !

    over-writing the file is the primary goal, and must be achieved regardless of consequences (side effects can be dealt with later !)

    Also, i see an option in the File.Install action of "sharedsystem" ... whilst i have a basic understanding of this function, i also have a question .... if the file being replaced/overwritten already has this set to true, what happens to this setting/flag when a File.Copy action replaces the file with another one ?


    cheers

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    have you tried deleting the file 1st, then check if it exists, then copy the file
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Oct 2006
    Posts
    345
    manual deletion of the file seems to allow the AMS code to transfer in the new file, i'm in the middle of testing the code to delete the file first, but early indications are that its not being deleted before the transfer takes place.

    it's kinda got me baffled at the moment, but pc issues here are causing me to focus on that first

  4. #4
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Quote Originally Posted by qwerty View Post
    when transfering files from your project to a system, where 99% of the time the files will already exist, which is the better / correct action to use.
    The absolute best in that case would be to use DeltaMAX, especially if the files in question are large. Of course that is a more expensive option and probably overkill in your case.

    File.Install with appropriate overwrite settings is what you want. It sounds like you're describing FILE_INSTALL_ALWAYS, but that is not something you should use unless you're sure you want to replace the existing files with your versions -- even if the one the user has is newer.

    i need to be 100% sure that the files are over-written/replaced.
    The return value from File.Install will tell you whether the operation succeeded. If you really need to be 110% sure, checksum the files after installing them (using CRC32 or MD5).

    i see the File.Install action has a backup file option, does this rename the existing file allowing a clear route for then transferring the new file in, or does it create a copy of the original file and rename it, meaning that the action must still over-write the original file ?
    The help file is incredibly clear about this. "Any existing file will be renamed to filename.bak. If filename.bak already exists, the file will be renamed to filename.bk1 instead, or filename.bk2, or filename.bk3, etc. The new file will only be installed after the existing one has been backed up."

    I'm not sure why you're concerned about the action needing to overwrite the existing file, that's what File.Install is built to do. You don't need to delete the file first -- using FILE_INSTALL_ALWAYS will achieve the same effect.

    over-writing the file is the primary goal, and must be achieved regardless of consequences (side effects can be dealt with later !)
    Be very careful. If any of the files you're installing are system files (DLLs and such) I would strongly caution you not to do this.

    Also, i see an option in the File.Install action of "sharedsystem" ... whilst i have a basic understanding of this function, i also have a question .... if the file being replaced/overwritten already has this set to true, what happens to this setting/flag when a File.Copy action replaces the file with another one ?
    I believe in that case the reference count gets incremented.
    --[[ Indigo Rose Software Developer ]]

  5. #5
    Join Date
    Oct 2006
    Posts
    345
    ok, firstly , thank you for the well laid out reply answering my questions.

    Yes, you are correct the proceedure i was describing and intending to use was FILE_INSTALL_ALWAYS

    I iwll look into the return value thing for checking, that could be what i need.

    where you say this
    The help file is incredibly clear about this. "Any existing file will be renamed to filename.bak. If filename.bak already exists, the file will be renamed to filename.bk1 instead, or filename.bk2, or filename.bk3, etc. The new file will only be installed after the existing one has been backed up."
    ok, so as i understand that then the original file is renamed and then there should be no issues encountered on transferring the new file in,


    The reason for these strange questions is that i have hit a problem relating to file transferring, and on some systems it works and others it doesnt, this appears not to be an error in the script, more a system block on over-writing the file especially if the orignal is newer, Hence the reason i want the original file out of the way. My bet is that windows vista is causing issues becasue of it's love of playing god

  6. #6
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Be careful. The OS usually has good reasons to protect its files.

    What kinds of files are you trying to replace?
    --[[ Indigo Rose Software Developer ]]

  7. #7
    Join Date
    Oct 2006
    Posts
    345
    mixed, exe,dll,sys (but not a shared or M$ sys files) and a couple ico files.

    it seems i was doing something wrong, becasue even with the rename thing set to on it fails to even rename them, i've gone back to file.copy, and have tried to build an error check into the routine.

    when i get more time i will revisit this issue, because it was behaving just as if the destination was wrong, and thus couldnt find the files, very strange, as its the same variable used to supply the destination path for the fil.copy command as it was for the file.install one

  8. #8
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Are you sure it's the same? (Could be a typo.) Is anything else different as well? Check the contents of that variable in both cases using a Dialog.Message action (or Debug.Print or something).
    --[[ Indigo Rose Software Developer ]]

  9. #9
    Join Date
    Oct 2006
    Posts
    345
    if i wasnt using so much copy and paste i would be more inclined to believe that, with my typing abilities !

    but as i modified the File.Install to File.Copy by over typing Install with Copy and changed the parameters (true flase etc) at the end by copying the first one i changed manually, and all seems to work, i dont think it's a typo on the file path or name

  10. #10
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Check the contents of that variable in both cases using a Dialog.Message action (or Debug.Print or something).
    --[[ Indigo Rose Software Developer ]]

Similar Threads

  1. File.Install Help
    By shinyrory in forum AutoPlay Media Studio 6.0
    Replies: 6
    Last Post: 02-11-2007, 12:17 PM
  2. File.Copy recursive error handling
    By Buffman in forum AutoPlay Media Studio 6.0
    Replies: 0
    Last Post: 12-06-2006, 12:56 PM
  3. File.copy
    By vdillum in forum Setup Factory 7.0
    Replies: 7
    Last Post: 07-05-2006, 09:19 AM
  4. File Locks with File.Install?
    By mcgill in forum TrueUpdate 2.0
    Replies: 5
    Last Post: 03-17-2006, 11:14 AM
  5. File.Copy does not work as advertised
    By tkilshaw in forum Setup Factory 7.0
    Replies: 2
    Last Post: 05-17-2005, 11:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts