Results 1 to 4 of 4

Thread: nsis script question: directory tree

  1. #1
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default nsis script question: directory tree

    I've a simple NSIS script for packaging my executable and a directory tree. My script looks like this:

    Qt Code:
    1. outFile "my_installer.exe"
    2.  
    3. installDir .
    4.  
    5. section
    6.  
    7. setOutPath $INSTDIR
    8.  
    9. file ..\interface\release\myApp.exe
    10. file /r ..\interface\data
    11.  
    12. sectionEnd
    To copy to clipboard, switch view to plain text mode 

    There are no links or shortcuts in "data", just files and sub-directories w/more files & directories. I want to preserve the tree so that "myApp.exe" and "data" (with all its files & subdirectories) reside in the installation directory.

    When I run the installer, however, I get:

    Error opening file for writing:

    .\data\a_little_test_file.txt

    Abort | Retry | Ignore
    What should I add so that the installer can create the necessary directories and write to them?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: nsis script question: directory tree

    What happens when you specify different installation directory? Like InstallDir "$PROGRAMFILES\test"

  3. The following user says thank you to jacek for this useful post:

    vonCZ (27th November 2008)

  4. #3
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: nsis script question: directory tree

    Yes, that works Jacek, thanks. In my case, however: I want to install the application & its companion directory tree into the same directory in which the installer.exe resides.

    After messing around with it, I found that this works:

    OutFile "my_installer.exe"

    InstallDir .

    Section

    SetOutPath $INSTDIR
    File ..\interface\release\myApp.exe

    SetOutPath "$EXEDIR\data"
    File /r ..\interface\data\*.*

    SectionEnd
    This is essentially what I had before, except I'm using

    $EXEDIR\data

    instead of

    $INSTDIR\data

    $EXEDIR is "the location of the installer executable"... but since I set $INSTDIR to *also* be the location of the installer executable (i.e. "."), I'm not sure why that didn't work. It would install "myApp.exe" into the local directory, but it wouldn't install the directory tree. ...not sure why.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: nsis script question: directory tree

    Quote Originally Posted by vonCZ View Post
    but since I set $INSTDIR to *also* be the location of the installer executable (i.e. "."), I'm not sure why that didn't work.
    I think the problem is that windows don't understand "." and treat it as an incorrect name of a directory.

Similar Threads

  1. install help nedded.
    By aj2903 in forum Installation and Deployment
    Replies: 9
    Last Post: 13th November 2008, 07:57
  2. Display a file from Directory tree to show in QTextEdit
    By vvdounai in forum Qt Programming
    Replies: 1
    Last Post: 13th November 2007, 13:43
  3. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.