Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to set TargetDir to ProgramFiles? [SOLVED]

How to set TargetDir to ProgramFiles? [SOLVED]

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 3 Posters 6.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amahta
    wrote on last edited by
    #1

    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?

    Thou shalt programme
    http://www.amin-ahmadi.com

    1 Reply Last reply
    0
    • A Offline
      A Offline
      amahta
      wrote on last edited by
      #2

      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");
      }
      @

      Thou shalt programme
      http://www.amin-ahmadi.com

      1 Reply Last reply
      1
      • W Offline
        W Offline
        wesblake
        wrote on last edited by
        #3

        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. :)

        1 Reply Last reply
        0
        • PrezesP Offline
          PrezesP Offline
          Prezes
          wrote on last edited by
          #4

          Do You know how can I make this with Dir:

          Program Files x64 ?

          I have try all nothing work fine.

          A 1 Reply Last reply
          0
          • PrezesP Prezes

            Do You know how can I make this with Dir:

            Program Files x64 ?

            I have try all nothing work fine.

            A Offline
            A Offline
            amahta
            wrote on last edited by amahta
            #5

            @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 :)

            Thou shalt programme
            http://www.amin-ahmadi.com

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved