Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Installer framework Rmdir to remove directory error
Forum Updated to NodeBB v4.3 + New Features

Qt Installer framework Rmdir to remove directory error

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 605 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.
  • M Offline
    M Offline
    MarKS
    wrote on 26 Dec 2021, 18:20 last edited by
    #1

    I have a set of operations I need to perform in a sequence for my installation. Here is how it looks right now:

    <Operations>
    	<Operation name="CreateShortcut">
    		<Argument>@TargetDir@/App.exe</Argument>
    		<Argument>@StartMenuDir@/App.lnk</Argument>
    	</Operation>
    	<Operation name="CreateShortcut">
    		<Argument>@TargetDir@/App.exe</Argument>
    		<Argument>@HomeDir@/Desktop/App.lnk</Argument>
    	</Operation>
    	<Operation name="Mkdir">
    		<Argument>C:/ProgramData/DesktopApp/Config</Argument>			
    	</Operation>
    	<Operation name="Mkdir">
    		<Argument>C:/ProgramData/DesktopApp/Logs</Argument>			
    	</Operation>
    	<Operation name="CopyDirectory">
    		<Argument>@TargetDir@/Config</Argument>
    		<Argument>C:/ProgramData/DesktopApp/Config</Argument>
    	</Operation>
    	<Operation name="CopyDirectory">
    		<Argument>@TargetDir@/Logs</Argument>
    		<Argument>C:/ProgramData/DesktopApp/Logs</Argument>
    	</Operation>
    	<Operation name="Rmdir">
    		<Argument>@TargetDir@/Config</Argument>			
    	</Operation>
    	<Operation name="Rmdir">
    		<Argument>@TargetDir@/Logs</Argument>			
    	</Operation>
    </Operations>
    

    Installation fails with an error "Cannot remove directory /path-to-installation/Config". Same issue with removing the Logs folder as well.

    I also had an issue with the CopyDirectory operation when the directory that is to be copied does not exist at the destination. Fixed it by following this issue here. Not sure if Rmdir is also somehow related to this.

    The default path to my installation is C:/Program Files/ and I am using Qt installer framework 4.2

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MarKS
      wrote on 26 Dec 2021, 19:10 last edited by
      #2

      I figured it out. If the folders contain files then the Rmdir command fails to work. In order to make it work, I removed all the files using Delete command under the folders Config and Logs. Then, I used the command Rmdir to delete the directories successfully.

      Fortunately, I only have a couple of files in the directories which I removed using Delete command. If there are many files inside the directory then I think is this not an appropriate solution. Since each file needs to be named under Delete command. Not very efficient.

      There might be other ways to delete sub-folders, files recursively using Rmdir but as of now, I do not have any idea. If anyone knows how to solve this issue, feel free to add your solution.

      1 Reply Last reply
      0

      1/2

      26 Dec 2021, 18:20

      • Login

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