diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2019-09-27 23:03:13 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2019-10-09 13:24:58 +0000 |
commit | f1285fcf061669702ca1accd7b2c50ebc8198993 (patch) | |
tree | e4e0e83535f5de15388d4af4e80841b28ef99a89 | |
parent | 931a80492da92fe29fab6ac41eb219a6ca6b53d7 (diff) |
CMake: Don't install HTML manuals twice
HTML docs are installed to both $docdir and $pkgdatadir. Fix that
to install to $docdir only.
Change-Id: I115158585b6df9170d9a01249adbc8548df91f14
Reviewed-on: https://code.wireshark.org/review/34640
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
-rw-r--r-- | CMakeLists.txt | 36 | ||||
-rw-r--r-- | cmake/modules/CopyStaging.cmake | 37 | ||||
-rw-r--r-- | debian/libwsutil0.symbols | 3 | ||||
-rw-r--r-- | doc/CMakeLists.txt | 26 | ||||
-rw-r--r-- | extcap/androiddump.c | 2 | ||||
-rw-r--r-- | extcap/ciscodump.c | 2 | ||||
-rw-r--r-- | extcap/randpktdump.c | 2 | ||||
-rw-r--r-- | extcap/sdjournal.c | 2 | ||||
-rw-r--r-- | extcap/sshdump.c | 2 | ||||
-rw-r--r-- | extcap/udpdump.c | 2 | ||||
-rw-r--r-- | packaging/nsis/wireshark.nsi | 38 | ||||
-rw-r--r-- | packaging/wix/ComponentGroups.wxi | 38 | ||||
-rw-r--r-- | ui/help_url.c | 22 | ||||
-rw-r--r-- | wsutil/CMakeLists.txt | 1 | ||||
-rw-r--r-- | wsutil/filesystem.c | 33 | ||||
-rw-r--r-- | wsutil/filesystem.h | 13 |
16 files changed, 161 insertions, 98 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f9ae5d57ca..f354b999f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1729,42 +1729,8 @@ set(INSTALL_FILES smi_modules wka docbook/ws.css - ${CMAKE_BINARY_DIR}/doc/AUTHORS-SHORT - ${CMAKE_BINARY_DIR}/doc/androiddump.html - ${CMAKE_BINARY_DIR}/doc/udpdump.html - ${CMAKE_BINARY_DIR}/doc/capinfos.html - ${CMAKE_BINARY_DIR}/doc/captype.html - ${CMAKE_BINARY_DIR}/doc/ciscodump.html - ${CMAKE_BINARY_DIR}/doc/dftest.html - ${CMAKE_BINARY_DIR}/doc/dumpcap.html - ${CMAKE_BINARY_DIR}/doc/editcap.html - ${CMAKE_BINARY_DIR}/doc/extcap.html - ${CMAKE_BINARY_DIR}/doc/mergecap.html - ${CMAKE_BINARY_DIR}/doc/randpkt.html - ${CMAKE_BINARY_DIR}/doc/randpktdump.html - ${CMAKE_BINARY_DIR}/doc/rawshark.html - ${CMAKE_BINARY_DIR}/doc/reordercap.html - ${CMAKE_BINARY_DIR}/doc/sshdump.html - ${CMAKE_BINARY_DIR}/doc/text2pcap.html - ${CMAKE_BINARY_DIR}/doc/tshark.html - ${CMAKE_BINARY_DIR}/doc/wireshark.html - ${CMAKE_BINARY_DIR}/doc/wireshark-filter.html ) -if(MAXMINDDB_FOUND) - list(APPEND INSTALL_FILES ${CMAKE_BINARY_DIR}/doc/mmdbresolve.html) -endif() - -if (BUILD_corbaidl2wrs) - list(APPEND INSTALL_FILES ${CMAKE_BINARY_DIR}/doc/idl2wrs.html) -endif() -if (BUILD_xxx2deb) - list(APPEND INSTALL_FILES - ${CMAKE_BINARY_DIR}/doc/asn2deb.html - ${CMAKE_BINARY_DIR}/doc/idl2deb.html - ) -endif() - if(WIN32) set(TEXTIFY_FILES COPYING NEWS README.windows) set(TEXTIFY_MD_FILES README.md) @@ -2006,7 +1972,6 @@ foreach(_install_file ${INSTALL_FILES}) "${_install_file_src}" "${_output_file}" DEPENDS - docs "${_install_file}" ) list(APPEND copy_data_files_depends "${_output_file}") @@ -2035,7 +2000,6 @@ if(LUA_FOUND AND ENABLE_LUA) ) endforeach() endif(LUA_FOUND AND ENABLE_LUA) -# doc/*.html handled elsewhere. # Glob patterns relative to the source directory that should be copied to # ${DATAFILE_DIR} (including directory prefixes) diff --git a/cmake/modules/CopyStaging.cmake b/cmake/modules/CopyStaging.cmake new file mode 100644 index 0000000000..85f736d634 --- /dev/null +++ b/cmake/modules/CopyStaging.cmake @@ -0,0 +1,37 @@ +# +# Add a custom target to copy support files to our staging directory. +# +# add_staging_target(Name +# [DEST dir] +# [DEPENDS target1 [target2 ...]] +# FILES file1 [file2 ...]) +# + +function(add_staging_target TARGET_NAME) + cmake_parse_arguments(_ARG "" "DEST" "DEPENDS;FILES" ${ARGN}) + + foreach(_input_file ${_ARG_FILES}) + get_filename_component(_file_basename "${_input_file}" NAME) + if(_ARG_DEST) + set(_dest_dir "${_ARG_DEST}") + else() + set(_dest_dir "${CMAKE_BINARY_DIR}/run") + endif() + set(_output_file "${_dest_dir}/${_file_basename}") + add_custom_command(OUTPUT "${_output_file}" + COMMAND ${CMAKE_COMMAND} -E make_directory + "${_dest_dir}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${_input_file}" + "${_output_file}" + DEPENDS + "${_input_file}" + ) + list(APPEND _files_depends "${_output_file}") + endforeach() + + add_custom_target(${TARGET_NAME} ALL DEPENDS ${_files_depends}) + if(_ARG_DEPENDS) + add_dependencies(${TARGET_NAME} ${_ARG_DEPENDS}) + endif() +endfunction() diff --git a/debian/libwsutil0.symbols b/debian/libwsutil0.symbols index ccbf06bd46..4efa5e2f46 100644 --- a/debian/libwsutil0.symbols +++ b/debian/libwsutil0.symbols @@ -56,7 +56,7 @@ libwsutil.so.0 libwsutil0 #MINVER# crypt_des_ecb@Base 2.3.0 crypto_scalarmult_curve25519@Base 2.9.0 crypto_scalarmult_curve25519_base@Base 2.9.0 - data_file_url@Base 2.3.0 + help_file_url@Base 3.1.1 decrypt_xtea_ecb@Base 2.5.0 decrypt_xtea_le_ecb@Base 2.5.0 delete_persconffile_profile@Base 1.12.0~rc1 @@ -79,6 +79,7 @@ libwsutil.so.0 libwsutil0 #MINVER# get_datafile_dir@Base 1.12.0~rc1 get_datafile_path@Base 1.12.0~rc1 get_dirname@Base 1.12.0~rc1 + get_docfile_dir@Base 3.1.1 get_extcap_dir@Base 1.99.0 get_global_profiles_dir@Base 1.12.0~rc1 get_os_version_info@Base 1.99.0 diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 429deaa4f0..f6866c8066 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -7,6 +7,8 @@ # SPDX-License-Identifier: GPL-2.0-or-later # +include(CopyStaging) + add_custom_command( OUTPUT AUTHORS-SHORT COMMAND ${PERL_EXECUTABLE} @@ -211,6 +213,23 @@ add_custom_target( ) set_target_properties(docs PROPERTIES FOLDER "Docs") +if(ENABLE_APPLICATION_BUNDLE) + set(DOC_STAGING_DIR "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}/Wireshark.app/Contents/Resources/share/doc/wireshark") +else() + set(DOC_STAGING_DIR "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}/doc") +endif() + +add_staging_target(docs_copy_staging + DEST "${DOC_STAGING_DIR}" + DEPENDS docs + FILES ${HTML_INSTALL_FILES} +) + +add_staging_target(authors_copy_staging + DEST "${DATAFILE_DIR}" + FILES ${CMAKE_CURRENT_BINARY_DIR}/AUTHORS-SHORT +) + install( FILES ${MAN1_INSTALL_FILES} @@ -232,6 +251,13 @@ install( ${CMAKE_INSTALL_DOCDIR} ) +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/AUTHORS-SHORT + DESTINATION + ${CMAKE_INSTALL_DATADIR} +) + # # Editor modelines - https://www.wireshark.org/tools/modelines.html # diff --git a/extcap/androiddump.c b/extcap/androiddump.c index 3832da27b3..ba464b694e 100644 --- a/extcap/androiddump.c +++ b/extcap/androiddump.c @@ -2528,7 +2528,7 @@ int main(int argc, char *argv[]) { extcap_conf = g_new0(extcap_parameters, 1); - help_url = data_file_url("androiddump.html"); + help_url = help_file_url("androiddump.html"); extcap_base_set_util_info(extcap_conf, argv[0], ANDROIDDUMP_VERSION_MAJOR, ANDROIDDUMP_VERSION_MINOR, ANDROIDDUMP_VERSION_RELEASE, help_url); g_free(help_url); diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c index 681d1e1a5d..88148b6595 100644 --- a/extcap/ciscodump.c +++ b/extcap/ciscodump.c @@ -547,7 +547,7 @@ int main(int argc, char *argv[]) g_free(err_msg); } - help_url = data_file_url("ciscodump.html"); + help_url = help_file_url("ciscodump.html"); extcap_base_set_util_info(extcap_conf, argv[0], CISCODUMP_VERSION_MAJOR, CISCODUMP_VERSION_MINOR, CISCODUMP_VERSION_RELEASE, help_url); g_free(help_url); diff --git a/extcap/randpktdump.c b/extcap/randpktdump.c index 659e829be9..e489053a6e 100644 --- a/extcap/randpktdump.c +++ b/extcap/randpktdump.c @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) g_free(err_msg); } - help_url = data_file_url("randpktdump.html"); + help_url = help_file_url("randpktdump.html"); extcap_base_set_util_info(extcap_conf, argv[0], RANDPKTDUMP_VERSION_MAJOR, RANDPKTDUMP_VERSION_MINOR, RANDPKTDUMP_VERSION_RELEASE, help_url); g_free(help_url); diff --git a/extcap/sdjournal.c b/extcap/sdjournal.c index b2a2d5d9e5..357078c06c 100644 --- a/extcap/sdjournal.c +++ b/extcap/sdjournal.c @@ -355,7 +355,7 @@ int main(int argc, char **argv) g_free(init_progfile_dir_error); } - help_url = data_file_url("sdjournal.html"); + help_url = help_file_url("sdjournal.html"); extcap_base_set_util_info(extcap_conf, argv[0], SDJOURNAL_VERSION_MAJOR, SDJOURNAL_VERSION_MINOR, SDJOURNAL_VERSION_RELEASE, help_url); g_free(help_url); diff --git a/extcap/sshdump.c b/extcap/sshdump.c index 84326c1ee2..70ceb0f27d 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -369,7 +369,7 @@ int main(int argc, char *argv[]) g_free(err_msg); } - help_url = data_file_url("sshdump.html"); + help_url = help_file_url("sshdump.html"); extcap_base_set_util_info(extcap_conf, argv[0], SSHDUMP_VERSION_MAJOR, SSHDUMP_VERSION_MINOR, SSHDUMP_VERSION_RELEASE, help_url); g_free(help_url); diff --git a/extcap/udpdump.c b/extcap/udpdump.c index bfc725f1f2..aa0812541e 100644 --- a/extcap/udpdump.c +++ b/extcap/udpdump.c @@ -380,7 +380,7 @@ int main(int argc, char *argv[]) g_free(err_msg); } - help_url = data_file_url("udpdump.html"); + help_url = help_file_url("udpdump.html"); extcap_base_set_util_info(extcap_conf, argv[0], UDPDUMP_VERSION_MAJOR, UDPDUMP_VERSION_MINOR, UDPDUMP_VERSION_RELEASE, help_url); g_free(help_url); diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi index 1c92387735..1646adf52b 100644 --- a/packaging/nsis/wireshark.nsi +++ b/packaging/nsis/wireshark.nsi @@ -497,11 +497,11 @@ File "${STAGING_DIR}\wka" File "${STAGING_DIR}\services" File "${STAGING_DIR}\pdml2html.xsl" File "${STAGING_DIR}\ws.css" -File "${STAGING_DIR}\wireshark.html" -File "${STAGING_DIR}\wireshark-filter.html" +File "${STAGING_DIR}\doc\wireshark.html" +File "${STAGING_DIR}\doc\wireshark-filter.html" File "${STAGING_DIR}\dumpcap.exe" -File "${STAGING_DIR}\dumpcap.html" -File "${STAGING_DIR}\extcap.html" +File "${STAGING_DIR}\doc\dumpcap.html" +File "${STAGING_DIR}\doc\extcap.html" File "${STAGING_DIR}\ipmap.html" ; C-runtime redistributable @@ -974,7 +974,7 @@ Section "TShark" SecTShark ;------------------------------------------- SetOutPath $INSTDIR File "${STAGING_DIR}\tshark.exe" -File "${STAGING_DIR}\tshark.html" +File "${STAGING_DIR}\doc\tshark.html" SectionEnd SectionGroup "Plugins & Extensions" SecPluginsGroup @@ -1064,63 +1064,63 @@ Section "Editcap" SecEditcap ;------------------------------------------- SetOutPath $INSTDIR File "${STAGING_DIR}\editcap.exe" -File "${STAGING_DIR}\editcap.html" +File "${STAGING_DIR}\doc\editcap.html" SectionEnd Section "Text2Pcap" SecText2Pcap ;------------------------------------------- SetOutPath $INSTDIR File "${STAGING_DIR}\text2pcap.exe" -File "${STAGING_DIR}\text2pcap.html" +File "${STAGING_DIR}\doc\text2pcap.html" SectionEnd Section "Mergecap" SecMergecap ;------------------------------------------- SetOutPath $INSTDIR File "${STAGING_DIR}\mergecap.exe" -File "${STAGING_DIR}\mergecap.html" +File "${STAGING_DIR}\doc\mergecap.html" SectionEnd Section "Reordercap" SecReordercap ;------------------------------------------- SetOutPath $INSTDIR File "${STAGING_DIR}\reordercap.exe" -File "${STAGING_DIR}\reordercap.html" +File "${STAGING_DIR}\doc\reordercap.html" SectionEnd Section "DFTest" SecDFTest ;------------------------------------------- SetOutPath $INSTDIR File "${STAGING_DIR}\dftest.exe" -File "${STAGING_DIR}\dftest.html" +File "${STAGING_DIR}\doc\dftest.html" SectionEnd Section "Capinfos" SecCapinfos ;------------------------------------------- SetOutPath $INSTDIR File "${STAGING_DIR}\capinfos.exe" -File "${STAGING_DIR}\capinfos.html" +File "${STAGING_DIR}\doc\capinfos.html" SectionEnd Section "Rawshark" SecRawshark ;------------------------------------------- SetOutPath $INSTDIR File "${STAGING_DIR}\rawshark.exe" -File "${STAGING_DIR}\rawshark.html" +File "${STAGING_DIR}\doc\rawshark.html" SectionEnd Section /o "Randpkt" SecRandpkt ;------------------------------------------- SetOutPath $INSTDIR File "${STAGING_DIR}\randpkt.exe" -File "${STAGING_DIR}\randpkt.html" +File "${STAGING_DIR}\doc\randpkt.html" SectionEnd !ifdef MMDBRESOLVE_EXE Section "MMDBResolve" SecMMDBResolve ;------------------------------------------- SetOutPath $INSTDIR -File "${STAGING_DIR}\mmdbresolve.html" +File "${STAGING_DIR}\doc\mmdbresolve.html" SetOutPath $INSTDIR File "${STAGING_DIR}\mmdbresolve.exe" SectionEnd @@ -1129,7 +1129,7 @@ SectionEnd Section /o "Androiddump" SecAndroiddumpinfos ;------------------------------------------- SetOutPath $INSTDIR -File "${STAGING_DIR}\androiddump.html" +File "${STAGING_DIR}\doc\androiddump.html" SetOutPath $INSTDIR\extcap File "${STAGING_DIR}\extcap\androiddump.exe" SectionEnd @@ -1137,8 +1137,8 @@ SectionEnd Section /o "SSHdump" SecSSHdumpinfos ;------------------------------------------- SetOutPath $INSTDIR -File "${STAGING_DIR}\sshdump.html" -File "${STAGING_DIR}\ciscodump.html" +File "${STAGING_DIR}\doc\sshdump.html" +File "${STAGING_DIR}\doc\ciscodump.html" SetOutPath $INSTDIR\extcap File "${STAGING_DIR}\extcap\sshdump.exe" File "${STAGING_DIR}\extcap\ciscodump.exe" @@ -1147,7 +1147,7 @@ SectionEnd Section /o "UDPdump" SecUDPdumpinfos ;------------------------------------------- SetOutPath $INSTDIR -File "${STAGING_DIR}\udpdump.html" +File "${STAGING_DIR}\doc\udpdump.html" SetOutPath $INSTDIR\extcap File "${STAGING_DIR}\extcap\udpdump.exe" SectionEnd @@ -1155,7 +1155,7 @@ SectionEnd Section /o "Randpktdump" SecRandpktdumpinfos ;------------------------------------------- SetOutPath $INSTDIR -File "${STAGING_DIR}\randpktdump.html" +File "${STAGING_DIR}\doc\randpktdump.html" SetOutPath $INSTDIR\extcap File "${STAGING_DIR}\extcap\randpktdump.exe" SectionEnd diff --git a/packaging/wix/ComponentGroups.wxi b/packaging/wix/ComponentGroups.wxi index 5468978bfd..70e87b32fb 100644 --- a/packaging/wix/ComponentGroups.wxi +++ b/packaging/wix/ComponentGroups.wxi @@ -58,19 +58,19 @@ <File Id="filWs_css" KeyPath="yes" Source="$(var.Staging.Dir)\ws.css" /> </Component> <Component Id="cmpWireshark_html" Guid="*"> - <File Id="filWireshark_html" KeyPath="yes" Source="$(var.Staging.Dir)\wireshark.html" /> + <File Id="filWireshark_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\wireshark.html" /> </Component> <Component Id="cmpWireshark_filter_html" Guid="*"> - <File Id="filWireshark_filter_html" KeyPath="yes" Source="$(var.Staging.Dir)\wireshark-filter.html" /> + <File Id="filWireshark_filter_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\wireshark-filter.html" /> </Component> <Component Id="cmpDumpcap_exe" Guid="*"> <File Id="filDumpcap_exe" KeyPath="yes" Source="$(var.Staging.Dir)\dumpcap.exe" /> </Component> <Component Id="cmpDumpcap_html" Guid="*"> - <File Id="filDumpcap_html" KeyPath="yes" Source="$(var.Staging.Dir)\dumpcap.html" /> + <File Id="filDumpcap_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\dumpcap.html" /> </Component> <Component Id="cmpExtcap_html" Guid="*"> - <File Id="filExtcap_html" KeyPath="yes" Source="$(var.Staging.Dir)\extcap.html" /> + <File Id="filExtcap_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\extcap.html" /> </Component> <Component Id="cmpIpmap_html" Guid="*"> <File Id="filIpmap_html" KeyPath="yes" Source="$(var.Staging.Dir)\ipmap.html" /> @@ -228,7 +228,7 @@ <File Id="filTShark_exe" KeyPath="yes" Source="$(var.Staging.Dir)\tshark.exe" /> </Component> <Component Id="cmpTShark_html" Guid="*"> - <File Id="filTShark_html" KeyPath="yes" Source="$(var.Staging.Dir)\tshark.html" /> + <File Id="filTShark_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\tshark.html" /> </Component> </DirectoryRef> </Fragment> @@ -274,7 +274,7 @@ <File Id="filEditcap_exe" KeyPath="yes" Source="$(var.Staging.Dir)\editcap.exe" /> </Component> <Component Id="cmpEditcap_html" Guid="*"> - <File Id="filEditcap_html" KeyPath="yes" Source="$(var.Staging.Dir)\editcap.html" /> + <File Id="filEditcap_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\editcap.html" /> </Component> </DirectoryRef> </Fragment> @@ -292,7 +292,7 @@ <File Id="filText2pcap_exe" KeyPath="yes" Source="$(var.Staging.Dir)\text2pcap.exe" /> </Component> <Component Id="cmpText2pcap_html" Guid="*"> - <File Id="filText2pcap_html" KeyPath="yes" Source="$(var.Staging.Dir)\text2pcap.html" /> + <File Id="filText2pcap_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\text2pcap.html" /> </Component> </DirectoryRef> </Fragment> @@ -310,7 +310,7 @@ <File Id="filMergecap_exe" KeyPath="yes" Source="$(var.Staging.Dir)\mergecap.exe" /> </Component> <Component Id="cmpMergecap_html" Guid="*"> - <File Id="filMergecap_html" KeyPath="yes" Source="$(var.Staging.Dir)\mergecap.html" /> + <File Id="filMergecap_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\mergecap.html" /> </Component> </DirectoryRef> </Fragment> @@ -328,7 +328,7 @@ <File Id="filReordercap_exe" KeyPath="yes" Source="$(var.Staging.Dir)\reordercap.exe" /> </Component> <Component Id="cmpReordercap_html" Guid="*"> - <File Id="filReordercap_html" KeyPath="yes" Source="$(var.Staging.Dir)\reordercap.html" /> + <File Id="filReordercap_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\reordercap.html" /> </Component> </DirectoryRef> </Fragment> @@ -346,7 +346,7 @@ <File Id="filDFTest_exe" KeyPath="yes" Source="$(var.Staging.Dir)\dftest.exe" /> </Component> <Component Id="cmpDFTest_html" Guid="*"> - <File Id="filDFTest_html" KeyPath="yes" Source="$(var.Staging.Dir)\dftest.html" /> + <File Id="filDFTest_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\dftest.html" /> </Component> </DirectoryRef> </Fragment> @@ -364,7 +364,7 @@ <File Id="filCapinfos_exe" KeyPath="yes" Source="$(var.Staging.Dir)\capinfos.exe" /> </Component> <Component Id="cmpCapinfos_html" Guid="*"> - <File Id="filCapinfos_html" KeyPath="yes" Source="$(var.Staging.Dir)\capinfos.html" /> + <File Id="filCapinfos_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\capinfos.html" /> </Component> </DirectoryRef> </Fragment> @@ -382,7 +382,7 @@ <File Id="filRawshark_exe" KeyPath="yes" Source="$(var.Staging.Dir)\rawshark.exe" /> </Component> <Component Id="cmpRawshark_html" Guid="*"> - <File Id="filRawshark_html" KeyPath="yes" Source="$(var.Staging.Dir)\rawshark.html" /> + <File Id="filRawshark_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\rawshark.html" /> </Component> </DirectoryRef> </Fragment> @@ -400,7 +400,7 @@ <File Id="filRandpkt_exe" KeyPath="yes" Source="$(var.Staging.Dir)\randpkt.exe" /> </Component> <Component Id="cmpRandpkt_html" Guid="*"> - <File Id="filRandpkt_html" KeyPath="yes" Source="$(var.Staging.Dir)\randpkt.html" /> + <File Id="filRandpkt_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\randpkt.html" /> </Component> </DirectoryRef> </Fragment> @@ -419,7 +419,7 @@ <File Id="filMmdbresolve_exe" KeyPath="yes" Source="$(var.Staging.Dir)\mmdbresolve.exe" /> </Component> <Component Id="cmpMmdbresolve_html" Guid="*"> - <File Id="filMmdbresolve_html" KeyPath="yes" Source="$(var.Staging.Dir)\mmdbresolve.html" /> + <File Id="filMmdbresolve_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\mmdbresolve.html" /> </Component> </DirectoryRef> </Fragment> @@ -440,7 +440,7 @@ </DirectoryRef> <DirectoryRef Id="INSTALLFOLDER"> <Component Id="cmpAndroiddump_html" Guid="*"> - <File Id="filAndroiddump_html" KeyPath="yes" Source="$(var.Staging.Dir)\androiddump.html" /> + <File Id="filAndroiddump_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\androiddump.html" /> </Component> </DirectoryRef> </Fragment> @@ -460,7 +460,7 @@ </DirectoryRef> <DirectoryRef Id="INSTALLFOLDER"> <Component Id="cmpRandpktdump_html" Guid="*"> - <File Id="filRandpktdump_html" KeyPath="yes" Source="$(var.Staging.Dir)\randpktdump.html" /> + <File Id="filRandpktdump_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\randpktdump.html" /> </Component> </DirectoryRef> </Fragment> @@ -480,7 +480,7 @@ </DirectoryRef> <DirectoryRef Id="INSTALLFOLDER"> <Component Id="cmpSshdump_html" Guid="*"> - <File Id="filSshdump_html" KeyPath="yes" Source="$(var.Staging.Dir)\sshdump.html" /> + <File Id="filSshdump_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\sshdump.html" /> </Component> </DirectoryRef> </Fragment> @@ -500,7 +500,7 @@ </DirectoryRef> <DirectoryRef Id="INSTALLFOLDER"> <Component Id="cmpCiscodump_html" Guid="*"> - <File Id="filCiscodump_html" KeyPath="yes" Source="$(var.Staging.Dir)\Ciscodump.html" /> + <File Id="filCiscodump_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\Ciscodump.html" /> </Component> </DirectoryRef> </Fragment> @@ -520,7 +520,7 @@ </DirectoryRef> <DirectoryRef Id="INSTALLFOLDER"> <Component Id="cmpUdpdump_html" Guid="*"> - <File Id="filUdpdump_html" KeyPath="yes" Source="$(var.Staging.Dir)\Udpdump.html" /> + <File Id="filUdpdump_html" KeyPath="yes" Source="$(var.Staging.Dir)\doc\Udpdump.html" /> </Component> </DirectoryRef> </Fragment> diff --git a/ui/help_url.c b/ui/help_url.c index d8aee0ffb6..65cb6ffa8f 100644 --- a/ui/help_url.c +++ b/ui/help_url.c @@ -130,34 +130,34 @@ topic_action_url(topic_action_e action) switch(action) { /* local manual pages */ case(LOCALPAGE_MAN_WIRESHARK): - url = data_file_url("wireshark.html"); + url = help_file_url("wireshark.html"); break; case(LOCALPAGE_MAN_WIRESHARK_FILTER): - url = data_file_url("wireshark-filter.html"); + url = help_file_url("wireshark-filter.html"); break; case(LOCALPAGE_MAN_CAPINFOS): - url = data_file_url("capinfos.html"); + url = help_file_url("capinfos.html"); break; case(LOCALPAGE_MAN_DUMPCAP): - url = data_file_url("dumpcap.html"); + url = help_file_url("dumpcap.html"); break; case(LOCALPAGE_MAN_EDITCAP): - url = data_file_url("editcap.html"); + url = help_file_url("editcap.html"); break; case(LOCALPAGE_MAN_MERGECAP): - url = data_file_url("mergecap.html"); + url = help_file_url("mergecap.html"); break; case(LOCALPAGE_MAN_RAWSHARK): - url = data_file_url("rawshark.html"); + url = help_file_url("rawshark.html"); break; case(LOCALPAGE_MAN_REORDERCAP): - url = data_file_url("reordercap.html"); + url = help_file_url("reordercap.html"); break; case(LOCALPAGE_MAN_TEXT2PCAP): - url = data_file_url("text2pcap.html"); + url = help_file_url("text2pcap.html"); break; case(LOCALPAGE_MAN_TSHARK): - url = data_file_url("tshark.html"); + url = help_file_url("tshark.html"); break; /* local help pages (User's Guide) */ @@ -228,7 +228,7 @@ topic_action_url(topic_action_e action) url = user_guide_url("ChAdvExpert.html"); break; case(HELP_EXTCAP_OPTIONS_DIALOG): - url = data_file_url("extcap.html"); + url = help_file_url("extcap.html"); break; case(HELP_STATS_SUMMARY_DIALOG): url = user_guide_url("ChStatSummary.html"); diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt index c7d017cf7b..af6084268d 100644 --- a/wsutil/CMakeLists.txt +++ b/wsutil/CMakeLists.txt @@ -10,6 +10,7 @@ add_definitions(-DPLUGIN_DIR=\"${CMAKE_INSTALL_PREFIX}/${PLUGIN_INSTALL_LIBDIR}\") add_definitions(-DEXTCAP_DIR=\"${CMAKE_INSTALL_PREFIX}/${EXTCAP_INSTALL_LIBDIR}\") add_definitions(-DDATA_DIR=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}\") +add_definitions(-DDOC_DIR=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}\") set(WSUTIL_PUBLIC_HEADERS adler32.h diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index 3526ac1fbb..97ec8a7ef7 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -57,6 +57,7 @@ char *persconffile_dir = NULL; char *datafile_dir = NULL; char *persdatafile_dir = NULL; char *persconfprofile = NULL; +char *docfile_dir = NULL; static gboolean do_store_persconffiles = FALSE; static GHashTable *profile_files = NULL; @@ -1883,6 +1884,32 @@ get_datafile_path(const char *filename) } } +static void init_docfile_dir(void) +{ + if (running_in_build_directory_flag) { + docfile_dir = g_build_filename(get_progfile_dir(), "doc", NULL); + return; + } +#ifdef _WIN32 + docfile_dir = g_strdup(get_progfile_dir()); +#else +#ifdef __APPLE__ + if (appbundle_dir != NULL) { + docfile_dir = g_build_filename(appbundle_dir, "Contents/Resources/share/doc/wireshark", (gchar *)NULL); + return; + } +#endif + docfile_dir = g_strdup(DOC_DIR); +#endif +} + +const char *get_docfile_dir(void) +{ + if (!docfile_dir) + init_docfile_dir(); + return docfile_dir; +} + /* * Return an error message for UNIX-style errno indications on open or * create operations. @@ -2261,7 +2288,7 @@ done: } gchar * -data_file_url(const gchar *filename) +help_file_url(const gchar *filename) { gchar *file_path; gchar *uri; @@ -2270,7 +2297,7 @@ data_file_url(const gchar *filename) if(g_path_is_absolute(filename)) { file_path = g_strdup(filename); } else { - file_path = g_strdup_printf("%s/%s", get_datafile_dir(), filename); + file_path = g_build_filename(get_docfile_dir(), filename, NULL); } /* XXX - check, if the file is really existing, otherwise display a simple_dialog about the problem */ @@ -2306,6 +2333,8 @@ free_progdirs(void) #endif g_free(extcap_dir); extcap_dir = NULL; + g_free(docfile_dir); + docfile_dir = NULL; } /* diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h index b204fe5932..e34a3616e6 100644 --- a/wsutil/filesystem.h +++ b/wsutil/filesystem.h @@ -66,6 +66,11 @@ WS_DLL_PUBLIC const char *get_plugins_pers_dir_with_version(void); WS_DLL_PUBLIC const char *get_extcap_dir(void); /* + * Get the directory in which document files are stored. + */ +WS_DLL_PUBLIC const char *get_docfile_dir(void); + +/* * Get the flag indicating whether we're running from a build * directory. */ @@ -321,15 +326,15 @@ WS_DLL_PUBLIC gboolean copy_file_binary_mode(const char *from_filename, /* - * Given a filename return a filesystem URL. Relative paths are prefixed with - * the datafile directory path. + * Given a help filename return a filesystem URL. Relative paths are prefixed with + * the directory path. * * @param filename A file name or path. Relative paths will be prefixed with - * the data file directory path. + * the directory path. * @return A filesystem URL for the file or NULL on failure. A non-NULL return * value must be freed with g_free(). */ -WS_DLL_PUBLIC gchar* data_file_url(const gchar *filename); +WS_DLL_PUBLIC gchar* help_file_url(const gchar *filename); /* * Free the internal structtures |