Probably a dumb question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • beeneeb
    Indigo Rose Customer
    • Sep 2006
    • 19

    Probably a dumb question

    I have a piece of software that requires a license file to run (extension .lf). The file must be unchanged at all times, even when the version changes. So, if Version 1.0 contains a license file and Version 1.1 contains the same license file, how do I prevent the Version 1.1 license file from overwriting the Version 1.0.

    In other words, I don't want the license file in Version 1.1 to overwrite the license file in Version 1.0. So, do I just not add the license file when I create the difference file for Version 1.1?
  • Lorne
    Indigo Rose Staff Member
    • Feb 2001
    • 2729

    #2
    Is the license file in version 1.0 and 1.1 exactly the same as what the user will have installed? Or does each user get a different license file? (After they install the product, do you send them a custom .lf file? Does your program write their name into the .lf file? etc.)

    Key point: If the installed license file is exactly the same, it doesn't matter; Visual Patch won't make any changes to a file unless a difference exists between the two versions. (If the 1.0 license file is the same as the 1.1 license file, there's nothing to do.)

    If the version 1.0 license file was a trial license, and your question is "how do I make a patch that won't overwrite the registered user's license with the trial license file?"...again it doesn't matter.

    Visual Patch will only ever patch a file if it's an exact match for a file that was in one of the older versions it knows about. Key point: If the user has a modified license file, its MD5 signature won't match any of the license files your patch knows about, and it won't patch it.

    There is one exception, of course: and that's it you turn on the "Force install" option for the version 1.1 license file. (The "Force install" option is off by default. Turning it on tells Visual Patch to always install the new version, regardless of what's already there.)

    Note: what follows is an entirely hypothetical situation -- as I explained above, normally you don't need to do anything extra at all.

    Okay, so what if you have "Force install" turned on? Or, what if your question is more like this: "my version 1.0 users need to keep the version 1.0 license file; the version 1.1 license file is the same for all 1.1 users, but it's different from version 1.0, and I don't want the patched users to have it...after they patch, I want them to still have the old 1.0 license file. How do I do this?" I can think of three ways that could be done.

    One way is to remove the license file from the new version, and make sure you have the "Delete legacy files" option turned off (Project > Settings, Advanced tab). Then the patch won't even know about the license file, and because "Delete legacy files" is turned off, the old files will just be left lying around.

    Another way is to use some custom scripting: add the license file as a primer file (Project > Resources, Primer Files tab), and then modify your "On Post Patch" script to copy the license file over from %TempLaunchFolder% only if it doesn't already exist. (And then to delete the file from %TempLaunchFolder%, e.g. from "On Shutdown.")

    The third way is to include the license file in the new version (just like you normally would), but give it a script condition based upon whether the file exists yet, or what its MD5 signature is.

    For example, you could put something like this in the Script Condition field, to make it not patch the file if it already exists:

    Code:
    File.DoesExist(SessionVar.Expand("%AppFolder%\\license.lf")) == false
    If, say, you wanted to avoid patching the version 1.0 license specifically, you could check the MD5 signature of the user's license file and only patch it if it doesn't match the signature of your version 1.0 license file:

    Code:
    Crypto.MD5DigestFromFile(SessionVar.Expand("%AppFolder%\\license.lf")) ~= "810b7f0b01022b738ed84d427e5c08e4"
    --[[ Indigo Rose Software Developer ]]

    Comment

    Working...
    X