Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Installer.performOperation() to edit and delete a file in installed payload? QT IFW

Installer.performOperation() to edit and delete a file in installed payload? QT IFW

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 2 Posters 1.0k 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.
  • dcouchD Offline
    dcouchD Offline
    dcouch
    wrote on last edited by
    #1

    I am trying to edit an installed file during the InstallationFinished stage of my installer. The code I am trying to run looks like this:

    if (installer.value("ExtrasDir") != installer.environmentVariable("PROGRAMDATA")) {
    
        if(installer.performOperation("AppendFile", "factoryExtrasLoc.txt", installer.value("ExtrasDir"))) {
            console.log("We have edited factory locations file.");
        }
    } else {
        if(installer.performOperation("Delete", "factoryExtrasLoc.txt")) {
            console.log("We have deleted factory extras locations file.");
        }
    }
    

    This code runs when InstallationFinished signal is sent. When running with the -v option on the created installer I get this in the output:

    [17473] perform operation: Delete
    [17473] - arguments: factoryExtrasLoc.txt
    [17473] Done
    [17496] We have deleted factory extras locations file.

    but the file is still in the directory of the installed payload. Likewise when I attempt the append file path the output looks like this:

    [19136] perform operation: AppendFile
    [19136] - arguments: factoryExtrasLoc.txt
    [19136] Done
    [19175] undo operation: AppendFile
    [19175] - arguments: factoryExtrasLoc.txt
    [19175] Done

    but my appended text is not within the file. I need to run this operation after extract but it doesn't seem to do what the documentation says:

    boolean performOperation(string name, stringlist arguments)

    Instantly performs the operation name with arguments.

    Am I using this method correctly? Is there a better option to edit a file installed by the installer or delete that file at installer finished?

    1 Reply Last reply
    0
    • dcouchD Offline
      dcouchD Offline
      dcouch
      wrote on last edited by
      #2

      I solved this by placing the code in the correct location in my component script, which is the addOperations() section. I changed the installer.performOperation() to component.addElevatedOperation().

      1 Reply Last reply
      3
      • N Offline
        N Offline
        npcfm
        wrote on last edited by
        #3

        To anyone who comes across this, you need to put the arguments into a list [arg1, arg2, ... argN].

        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