How to set TargetDir to ProgramFiles? [SOLVED]



  • I'm trying to create an installer file using Qt Installer Framework. I was wondering, is there any easy way to set TargetDir to Program Files folder in windows?



  • Solution to my problem was adding the following in Component's script file:
    @
    function Component()
    {
    // constructor
    var programFiles = installer.environmentVariable("ProgramFiles");
    if (programFiles !== "")
    installer.setValue("TargetDir", programFiles + "MyApp");
    }
    @



  • Hi there. I'm trying to do this as well (e.g., should be C:\Program Files\My_App on Windows).
    Your post was quite helpful in where to set it, but I'm still getting a different result from it. It's just setting it to whatever path I run the installer from. I.E., if I run the installer from my Desktop, it fills in
    C:\Users\myuser\Desktop\My_App
    Am I missing something? Wrong environment variable above perhaps? Thanks.
    UPDATE: Ignore me. I had bad syntax and apparently that's the default on error. Working now. :)



  • Do You know how can I make this with Dir:

    Program Files x64 ?

    I have try all nothing work fine.



  • @Prezes are you referring to QDir? This post is about scripts in Qt Installers. Are you trying to access Program Files x64 in Qt or Qt Installer?
    Note: "Program Files x64" in 64 bit Windows is actually named just "Program Files" and it does not exist at all in 32-bit. So if you are trying to do this in Qt Installer Framework then my solution in this post also applies to you :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.