This is our old Q&A Site. Please post any new questions and answers at

I have generated the following nsi script, which gets it done - but is there a way to use an environment variable to the local appdata\wireshark folder for the mate file?

Section "Custom Deployed Preferences" SecCustomPrefs
SetShellVarContext current
!include "VPatchLib.nsh"
SetOutPath '$INSTDIR'
File "${STAGING_DIR}\quantel.mate"
File "${STAGING_DIR}\preferences"
IfFileExists $APPDATA\Wireshark\decode_as_entries 0 patchdecode
; Extract the old file under name 'updatefile.txt'
;File /oname=decode_as_entries decode_as_entries_old
; Update the file - it will be replaced with the new version
DetailPrint "Updating decode_as_entries using patch..."
!insertmacro VPatchFile "${STAGING_DIR}\decode_as.pat" "$APPDATA\Wireshark\decode_as_entries" "$APPDATA\Wireshark\temporaryfile.txt"
goto enddecode
SetOutPath '$APPDATA\Wireshark'
File "${STAGING_DIR}\decode_as_entries"
SetShellVarContext all

*Edit - vastly better - dumped the quentin.mate file, and a stub properties file (with some prefdefined filters) into the application directory, so Wireshark loads those first. I've got a small patch that will be applied to decode_as_entries if it exists, otherwise it gets replaced. What would be the recommended way to get the files into the staging directory for deployment, or is it better to keep this as a manual process? Thanks for your help,

asked 30 Jun '16, 22:24

Scott%20Harman's gravatar image

Scott Harman
accept rate: 50%

edited 01 Jul '16, 02:34

grahamb's gravatar image

grahamb ♦

Your answer has been converted to a comment as that's how this site works. Please read the FAQ for more information.

(01 Jul '16, 01:26) Jaap ♦

Note I changed the title to better reflect what this question is actually asking.

(01 Jul '16, 02:34) grahamb ♦

Add a CMakeListsCustom.txt that adds a custom target with a copy command to copy your files from the source location to the staging dir. There's lots of examples of that in the top level CMakeLists.txt

permanent link

answered 01 Jul '16, 02:33

grahamb's gravatar image

grahamb ♦
accept rate: 22%

Hi @grahamb - can you give me a pointer on this please - I'm trying to add either a block or a command, and both are failing - Here's an example of what I've most recently tried which causes a crash:

#COMMAND (if not exist \"${DATAFILE_DIR}\\quantel.mate\" xcopy     "${CMAKE_SOURCE_DIR}/quantel.mate" "${DATAFILE_DIR}" /D /Y)
#COMMAND (xcopy "${CMAKE_SOURCE_DIR}/preferences" "${DATAFILE_DIR}" /D     /Y)
(06 Jul '16, 20:06) Scott Harman

Something like:

    COMMAND  ${CMAKE_COMMAND} -E copy_if_different

Although some of those variable definitions might not be set up when your custom file is included.

(07 Jul '16, 04:58) grahamb ♦

Here's the values I've added to CMakeListsCustom.txt The necessary bit was ADD_DEPENDENCIES

ADD_CUSTOM_TARGET(copy-quantel-files ALL
    COMMAND  ${CMAKE_COMMAND} -E copy_if_different
ADD_DEPENDENCIES(copy-quantel-files wireshark)

I've got a bunch of patches and stock preferences in there for first run up.

(19 Jul '16, 21:54) Scott Harman
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 30 Jun '16, 22:24

question was seen: 1,310 times

last updated: 20 Jul '16, 01:43

p​o​w​e​r​e​d by O​S​Q​A