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. QtIFW: How to use the Operation "Move"
Forum Updated to NodeBB v4.3 + New Features

QtIFW: How to use the Operation "Move"

Scheduled Pinned Locked Moved Solved Installation and Deployment
6 Posts 3 Posters 2.3k 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.
  • S Offline
    S Offline
    Schenk
    wrote on last edited by aha_1980
    #1

    Hi,

    i want to move files after extracing from archive. Whatever i try, it will not work.

    First, there seems to be a mistake in the documentation:

    Adding Operations to Components

    You might want to add custom operations after extracting the content, when copying files or patching file content, for example. You can create and add update operations to the installation from within a script using component::addOperation(). If you need to run an operation that requires administrative rights, use component::addElevatedOperation() instead.

    Operations need to be added before the actual installation step. Override component::createOperations() to register custom operations for a component.

    I want to copy or mov efiles after extracting the content. So i override the component::createOperations() and call component.addOperation();

    Component.prototype.createOperations = function()
    {
        component.createOperations();		
    	installer.performOperation("Mkdir", "@TargetDir@/lol");	
    	//installer.gainAdminRights();	
    	var dir = installer.value("TargetDir");	
    	QMessageBox.information("asasas", "asasa", "Exists " + installer.fileExists(dir + "/foo.txt"), QMessageBox.Ok);	// FALSE
    	installer.performOperation("Move", dir + "/foo.txt", dir + "/lol/");	
    	
    	QMessageBox.information("asasas", "asasa", "Exists " + installer.fileExists("C:/Users/hschenk/lol.txt"), QMessageBox.Ok);	
    	installer.performOperation("Move", "C:/Users/hschenk/lol.txt", "C:/Users/hschenk/lalalala/"); //*already created before the setup	
    }
    
    

    The problem is that the file foo.txt does not exists at the moment i call "Move".

    The second Problem is that the operation move does not really work. No matter how i call the command the lol.txt disappear and is not ion the directory lalalala

    How can i fix both problems? Can you give me an example?

    Thank you in advance.

    K RatzzR 2 Replies Last reply
    0
    • S Schenk

      Hi,

      i want to move files after extracing from archive. Whatever i try, it will not work.

      First, there seems to be a mistake in the documentation:

      Adding Operations to Components

      You might want to add custom operations after extracting the content, when copying files or patching file content, for example. You can create and add update operations to the installation from within a script using component::addOperation(). If you need to run an operation that requires administrative rights, use component::addElevatedOperation() instead.

      Operations need to be added before the actual installation step. Override component::createOperations() to register custom operations for a component.

      I want to copy or mov efiles after extracting the content. So i override the component::createOperations() and call component.addOperation();

      Component.prototype.createOperations = function()
      {
          component.createOperations();		
      	installer.performOperation("Mkdir", "@TargetDir@/lol");	
      	//installer.gainAdminRights();	
      	var dir = installer.value("TargetDir");	
      	QMessageBox.information("asasas", "asasa", "Exists " + installer.fileExists(dir + "/foo.txt"), QMessageBox.Ok);	// FALSE
      	installer.performOperation("Move", dir + "/foo.txt", dir + "/lol/");	
      	
      	QMessageBox.information("asasas", "asasa", "Exists " + installer.fileExists("C:/Users/hschenk/lol.txt"), QMessageBox.Ok);	
      	installer.performOperation("Move", "C:/Users/hschenk/lol.txt", "C:/Users/hschenk/lalalala/"); //*already created before the setup	
      }
      
      

      The problem is that the file foo.txt does not exists at the moment i call "Move".

      The second Problem is that the operation move does not really work. No matter how i call the command the lol.txt disappear and is not ion the directory lalalala

      How can i fix both problems? Can you give me an example?

      Thank you in advance.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @Schenk

      This is more a user driven forum and answering on IFW posts is typically slow, if there is an answer at all.

      Your question is very detailed and goes beyond the typical issues here. Therefore, I would recommend to ask the question on the developer mailing list

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Schenk
        wrote on last edited by
        #3

        Ehm..ok ;)

        1 Reply Last reply
        0
        • S Schenk

          Hi,

          i want to move files after extracing from archive. Whatever i try, it will not work.

          First, there seems to be a mistake in the documentation:

          Adding Operations to Components

          You might want to add custom operations after extracting the content, when copying files or patching file content, for example. You can create and add update operations to the installation from within a script using component::addOperation(). If you need to run an operation that requires administrative rights, use component::addElevatedOperation() instead.

          Operations need to be added before the actual installation step. Override component::createOperations() to register custom operations for a component.

          I want to copy or mov efiles after extracting the content. So i override the component::createOperations() and call component.addOperation();

          Component.prototype.createOperations = function()
          {
              component.createOperations();		
          	installer.performOperation("Mkdir", "@TargetDir@/lol");	
          	//installer.gainAdminRights();	
          	var dir = installer.value("TargetDir");	
          	QMessageBox.information("asasas", "asasa", "Exists " + installer.fileExists(dir + "/foo.txt"), QMessageBox.Ok);	// FALSE
          	installer.performOperation("Move", dir + "/foo.txt", dir + "/lol/");	
          	
          	QMessageBox.information("asasas", "asasa", "Exists " + installer.fileExists("C:/Users/hschenk/lol.txt"), QMessageBox.Ok);	
          	installer.performOperation("Move", "C:/Users/hschenk/lol.txt", "C:/Users/hschenk/lalalala/"); //*already created before the setup	
          }
          
          

          The problem is that the file foo.txt does not exists at the moment i call "Move".

          The second Problem is that the operation move does not really work. No matter how i call the command the lol.txt disappear and is not ion the directory lalalala

          How can i fix both problems? Can you give me an example?

          Thank you in advance.

          RatzzR Offline
          RatzzR Offline
          Ratzz
          wrote on last edited by Ratzz
          #4

          @Schenk
          I just tried with it. works fine.
          You should use addOperation insted of performOperation

          component.fileWithRegisteredType = installer.value("TargetDir") + "/Test/TESSSST.txt";
          component.addOperation("Move", "@TargetDir@/test.txt", component.fileWithRegisteredType);
          

          Ref : http://doc.qt.io/qtinstallerframework/operations.html

          --Alles ist gut.

          S 1 Reply Last reply
          2
          • RatzzR Ratzz

            @Schenk
            I just tried with it. works fine.
            You should use addOperation insted of performOperation

            component.fileWithRegisteredType = installer.value("TargetDir") + "/Test/TESSSST.txt";
            component.addOperation("Move", "@TargetDir@/test.txt", component.fileWithRegisteredType);
            

            Ref : http://doc.qt.io/qtinstallerframework/operations.html

            S Offline
            S Offline
            Schenk
            wrote on last edited by Schenk
            #5

            @Ratzz What do you do? Do you rename a file? TESSSST.txt to test.txt?

            Can you give me an example how to mov ea file to another folder?

            UPDATE: GOT IT! ;)

            Before:
            TargetDir
            -- /lola
            -- foo.txt

            component.fileWithRegisteredType = installer.value("TargetDir") + "/lola/lol/foo.txt";
            component.addOperation("Move", "@TargetDir@/lola/foo.txt", component.fileWithRegisteredType);
            

            Before:
            TargetDir
            -- /lola
            ---/lola/foo.txt
            -- foo.txt

            RatzzR 1 Reply Last reply
            0
            • S Schenk

              @Ratzz What do you do? Do you rename a file? TESSSST.txt to test.txt?

              Can you give me an example how to mov ea file to another folder?

              UPDATE: GOT IT! ;)

              Before:
              TargetDir
              -- /lola
              -- foo.txt

              component.fileWithRegisteredType = installer.value("TargetDir") + "/lola/lol/foo.txt";
              component.addOperation("Move", "@TargetDir@/lola/foo.txt", component.fileWithRegisteredType);
              

              Before:
              TargetDir
              -- /lola
              ---/lola/foo.txt
              -- foo.txt

              RatzzR Offline
              RatzzR Offline
              Ratzz
              wrote on last edited by
              #6

              @Schenk said in QtIFW: How to use the Operation "Move":

              What do you do?

              Move a file present in the installer to a path(or folder) you want after installation.

              Do you rename a file?

              No. It was a test case u can still give your text file name.

              --Alles ist gut.

              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