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. Qt Installer Framework detached process problem
Forum Updated to NodeBB v4.3 + New Features

Qt Installer Framework detached process problem

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
1 Posts 1 Posters 360 Views 1 Watching
  • 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.
  • MarKSM Offline
    MarKSM Offline
    MarKS
    wrote on last edited by MarKS
    #1

    I am trying to build an installer using Qt Framework Installer 4.2 where I need to remove some folders from C:/Program Files and C:/ProgramData. Referring to this I realized I need to pass arguments to detached process as a string list. Here is how my install script looks like:

    function Component()
    {
    }
    
    Component.prototype.createOperations = function()
    {
        try {
            // call the base create operations function
            component.createOperations();
        } catch (e) {
            console.log(e);
        }
    	
        if (systemInfo.productType === "windows") 
        {
    	component.addOperation("CreateShortcut", "@TargetDir@/App.exe", "@StartMenuDir@/Desktop Application.lnk",
            "workingDirectory=@TargetDir@");
    
            component.addOperation("CreateShortcut", "@TargetDir@/App.exe", "@HomeDir@/Desktop/Desktop Application.lnk");
    		
    		if(installer.fileExists(somePathFile))
    		{
    		  installer.executeDetached("cmd", ["del", "C:/ProgramData/DesktopApp/Config/settings.json"], "@TargetDir@");
    		  installer.executeDetached("cmd", ["/s", "rmdir", "C:/ProgramData/DesktopApp/Config"], "@TargetDir@");
    		}
    		
    		if(installer.fileExists(somePathFile))
    		{
    		  installer.executeDetached("cmd", ["del", "C:/ProgramData/DesktopApp/Logs/app_log.txt"], "@TargetDir@");
    		  installer.executeDetached("cmd", ["del", "C:/ProgramData/DesktopApp/Logs/app_log.old.txt"], "@TargetDir@");
    		  installer.executeDetached("cmd", ["/s", "rmdir", "C:/ProgramData/DesktopApp/Logs"], "@TargetDir@");
    		}
    		
             	installer.executeDetached("cmd", ["del", "@TargetDir@/Config/settings.json"], "@TargetDir@");
    		installer.executeDetached("cmd", ["/s", "rmdir", "@TargetDir@/Config"], "@TargetDir@");
    			
    		installer.executeDetached("cmd", ["del", "@TargetDir@/Logs/app_log.txt"], "@TargetDir@");
    		installer.executeDetached("cmd", ["del", "@TargetDir@/Logs/app_log.old.txt"], "@TargetDir@");
    		installer.executeDetached("cmd", ["/s", "rmdir", "@TargetDir@/Logs"], "@TargetDir@");	
        }
    }
    

    Running the installer successfully installs the program but none of the above commands perform. InstallationLog.txt looks like this:

    run application as detached process: "cmd" ("del", "C:/ProgramData/DesktopApp/Config/settings.json") "C:/Program Files/DesktopApp"
    

    Same output for the rest of the commands. It just doesn't delete anything.

    using component.addOperation("Execute", "...") method freezes the whole installation. So, I thought I would rather stick to installer object.

    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