Bugs item #1656236, was opened at 2007-02-09 08:42 Message generated for change (Settings changed) made by robmen You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=642714&aid=1656236&group_id=105970
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: documentation Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Lorne Laliberte (lornelaliberte) >Assigned to: Bob Arnson (barnson) Summary: FileSearch requires a parent folder found at depth 0 Initial Comment: While testing the <FileSearch> and <DirectorySearch> elements, I've discovered what is either a bug, or a limitation, in WiX or MSI. (Based on Rob's quote about the difficulty of working with AppSearch I think it's most likely a bug in WiX. :) It's a bit tricky to describe, but basically it has to do with the FileSearch element needing two things: - it must be in a DirectorySearch element that describes its parent folder with an effective depth of 0; although the attribute can be higher it must be found at level 0 - if that DirectorySearch has a parent DirectorySearch element, it must have been found at an effective depth of 0 as well For example: Let's assume we have the following folder structure: C:\Temp\a\b\c\d\e\f\ And inside that folder structure we have a file: C:\Temp\a\b\c\d\e\f\foo.txt This search will NOT work: <Property Id="FOO_DOT_TEXT_0"> <DirectorySearch Depth='0' Id="dir_search_0" Path="C:\Temp\a" > <FileSearch Id="file_search_0" Name="foo.txt" /> </DirectorySearch> </Property> This search will NOT work either: <Property Id="FOO_DOT_TEXT_1"> <DirectorySearch Depth='0' Id="dir_search_1" Path="C:\Temp" > <DirectorySearch Depth='8' Id="dir_search_2" Path="f" > <FileSearch Id="file_search_1" Name="foo.txt" /> </DirectorySearch> </DirectorySearch> </Property> This search will NOT work either: <Property Id="FOO_DOT_TEXT_2"> <DirectorySearch Depth='0' Id="dir_search_5" Path="C:\Temp" > <DirectorySearch Depth='5' Id="dir_search_6" Path="d" > <DirectorySearch Depth='2' Id="dir_search_7" Path="f" > <FileSearch Id="file_search_2" Name="foo.txt" /> </DirectorySearch> </DirectorySearch> </DirectorySearch> </Property> However, this search WILL work: <Property Id="FOO_DOT_TEXT_3"> <DirectorySearch Depth='0' Id="dir_search_8" Path="C:\Temp" > <DirectorySearch Depth='6' Id="dir_search_9" Path="e" > <DirectorySearch Depth='0' Id="dir_search_10" Path="f" > <FileSearch Id="file_search_3" Name="foo.txt" /> </DirectorySearch> </DirectorySearch> </DirectorySearch> </Property> One workaround I've found is to use two searches, like this: <Property Id="FOLDER_F"> <DirectorySearch Depth='0' Id="dir_search_11" Path="C:\Temp" > <DirectorySearch Depth='8' Id="dir_search_12" Path="f" /> </DirectorySearch> </Property> <Property Id="FOO_DOT_TEXT_4"> <DirectorySearch Depth='0' Id="dir_search_13" Path="[FOLDER_F]" > <FileSearch Id="file_search_4" Name="foo.txt" /> </DirectorySearch> </Property> ...which seems to work just fine so long as the properties are defined in the correct order. Is this a bug in WiX, or a limitation in MSI? So to summarize, there are two possible bugs: 1. you can't recursively search for a file without specifying its parent folder (the file must be found at an effective depth of 0) 2. you can't recursively search for the parent folder either (the file's parent folder must also be found at an effective depth of 0) ---------------------------------------------------------------------- Comment By: pmarcu (pmarcu) Date: 2007-10-31 13:43 Message: Logged In: YES user_id=1612676 Originator: NO Moving to be considered for a doc update. ---------------------------------------------------------------------- Comment By: Lorne Laliberte (lornelaliberte) Date: 2007-04-18 13:04 Message: Logged In: YES user_id=1705700 Originator: YES (Uh - I meant <DirectorySearch> where I used <Directory> above.) ---------------------------------------------------------------------- Comment By: Lorne Laliberte (lornelaliberte) Date: 2007-04-18 13:01 Message: Logged In: YES user_id=1705700 Originator: YES Ah, I think I just realized something. The Depth attribute means something different when there is a child <FileSearch> element. If there is no child <FileSearch> element, the Directory's @Depth means "the number of levels down from the parent <Directory> to look for @Path." If there is a child <FileSearch> element, the Directory's @Depth means "the number of levels down from @Path to look for the file." In the latter case, the <Directory> element itself is assumed to be have a depth of 0, which is why something like this doesn't work: <!-- DOES NOT WORK: --> <Property Id="FOO_DOT_TEXT_1"> <DirectorySearch Depth='0' Id="dir_search_1" Path="C:\Temp" > <DirectorySearch Depth='8' Id="dir_search_2" Path="f" > <FileSearch Id="file_search_1" Name="foo.txt" /> </DirectorySearch> </DirectorySearch> </Property> The Depth='8' isn't specifying the depth between dir_search_1 and dir_search_2, it's specifying the depth between dir_search 2 and file_search_1. The depth between dir_search_1 and dir_search_2 defaults to 0, which is why it fails. It becomes a bit clearer once you see what happens in the MSI database. :) Perhaps the documentation should be amended to clarify that the Depth attribute means something different (from the perspective of a WiX user, anyway) when a FileSearch is used. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=642714&aid=1656236&group_id=105970 ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ WiX-devs mailing list WiX-devs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-devs