Results 1 to 4 of 4

Thread: Is there a built-in Qt4 function to unarchive .tar files on Windows?

  1. #1
    Join Date
    Apr 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Is there a built-in Qt4 function to unarchive .tar files on Windows?

    I'm using Qt4.6, Qt Creator SDK and MinGW to write a simple program for Windows users to extract tar.gz archived files originally created on Linux.

    I have the .gz decompression working with zlib, but I'm wondering if there is an included or built-in function to restore the files and folders contained within the .tar file in a Windows OS.

    If not, is libarchive a good choice or are there better options to use with Qt4?

    Thanks for your advice.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is there a built-in Qt4 function to unarchive .tar files on Windows?

    I believe GZ support is built-in, but not tar, but thats such an easy archive format to support anyway.

    A lot of tar.gz files created on Linux will not fully extract on Windows as your moving from a case-sensitive file system to a case insensitive one, and secondly, soft-links are not supported unless you emulate them using NTFS symbolic links and junction points.

    If you can live with the above restrictions, then there is gzip, bzip and tar for Windows if you like the command line, and various archivers such as Winrar which support tar.gz files natively.

    Is there a reason you want to create your own version of such a tool?

  3. #3
    Join Date
    Apr 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is there a built-in Qt4 function to unarchive .tar files on Windows?

    Thanks for the reply. Personally, I use 7zip and Winrar for such operations.

    Quote Originally Posted by fatjuicymole View Post
    Is there a reason you want to create your own version of such a tool?
    It's not a full featured compression/decompression utility, just an extremely simple program for people running a Windows build of a Linux program which has addons in tar.gz format with a non-standard extension. People seem to have trouble using common utilities like 7zip. My program has the user browse to select the output directory, then drag the file or files to extract them. It's not intended for general decompression, just to ease installing addons for one program.

    I'm also using this as an exercise to learn the basics of Qt. The program is already working, except the last step from .tar to extracted archives. Since I'm new to Qt and searches didn't turn up much on the subject, I thought I would ask before going ahead with libarchive.

  4. #4
    Join Date
    Apr 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is there a built-in Qt4 function to unarchive .tar files on Windows?

    In case anyone is searching for this topic, I did have success with libarchive.

    I was able to build a working program based on the included libarchive examples by:

    Adding this to my .pro project file:

    Qt Code:
    1. LIBS += "C:\Program Files\GnuWin32\lib\libarchive.lib"
    To copy to clipboard, switch view to plain text mode 

    Putting these files in files in my Qt\2010.02.1\mingw\include folder:

    Qt Code:
    1. archive.h
    2. archive_entry.h
    3. libarchive-nonposix.h
    To copy to clipboard, switch view to plain text mode 

    Then including the .dlls in the folder with my .exe:

    Qt Code:
    1. libarchive2.dll
    2. bzip2.dll
    3. zlib1.dll
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. implementing windows function in qt
    By aj2903 in forum Qt Programming
    Replies: 4
    Last Post: 2nd December 2009, 14:55
  2. Replies: 3
    Last Post: 18th November 2009, 11:18
  3. Problems with loading ui files on windows
    By tyrdal in forum Qt Programming
    Replies: 2
    Last Post: 5th August 2009, 11:42
  4. Convert Windows .rc files for use by Qt?
    By pineweasel in forum Newbie
    Replies: 1
    Last Post: 1st June 2009, 15:53
  5. open files in different windows
    By ramaha8319 in forum Qt Tools
    Replies: 1
    Last Post: 27th April 2009, 14:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.