Here’s the deal… You are building a Windows CE operating system image that includes a bunch of files that need to be mapped to different folders in the file system – it could be that you are adding a web site for remote configuration of the Windows CE device, in which case files need to be mapped to the \Windows\www\wwwpub folder, and perhaps sub-folders that live under the wwwpub folder. In which case there’s the possibility that you might have two (or more files) of the same name, perhaps “default.htm” or “background.png”, or whatever.
Since files that are included into the Windows CE operating system image are initially mapped to the \Windows folder and need to be cloned/copied out to other folders (using everyones favorite .DAT files!) you have a problem, you can’t have two different background.jpg files in the \Windows folder.
So how to work around the issue?
One way to work around the issue is to map your conflicting files into the \Windows folder under different names, perhaps “background-1.png” and “background-2.png”, or perhaps even more useful would be to use GUIDs for the filenames! “FEF03A6B-16DD-43cc-968D-DA4EF0E8A592.png” for example (kidding!!).
Since the Windows CE build system requires the files to be placed into the _FLATRELEASEDIR (build folder for the project) you should rename the files before copying to the _FLATRELEASEDIR (and of course keep a note of which file is which).
Once the files are in the _FLATRELEASEDIR you then need to include the files into the operating system image – this is handled by a .BIB file – here’s a sample – in this sample I have two text files, both should be called “Fox.txt”, the contents of the files are different, and will need to be mapped to different folders in the final image.
; ; Copyright (c) 2008 Microsoft Corporation. All rights reserved. ; ; ; NOTE: if any of the .EXE's included in this component are .NETCF ; you will need to move them to the FILES section. ; MODULES ; Name Path Memory Type ; -------------- ------------------------------ ----------- FILES ; Name Path Memory Type ; -------------- ------------------------------ ----------- fox1.txt $(_FLATRELEASEDIR)\fox1.txt NK fox2.txt $(_FLATRELEASEDIR)\fox2.txt NK
If I were to build the operating system at this point I would have two text files in the \Windows folder, one called fox1.txt, the other called fox2.txt (see below).
I now need to map the files from the \Windows folder to the folders I need for my custom device image – in this case I will create a \Demo folder, and two sub-folders, one called “FirstFox”, and the second called “SecondFox” – the cunning plan is to have each folder contain a file called “fox.txt” (which contains the text “The quick brown fox jumps over the lazy dog”, and “*** Modified *** The quick brown fox jumps over the lazy dog” [the contents of the files are different so it’s easy to tell them apart]).
We use a .DAT file to map (and optionally rename) files from the \Windows folder to the destination folder – see the sample below.
root:-Directory("\"):-Directory("Demo") Directory("\Demo"):-Directory("FirstFox") Directory("\Demo\FirstFox"):-File("fox.txt","\windows\fox1.txt") root:-Directory("\"):-Directory("Demo") Directory("\Demo"):-Directory("SecondFox") Directory("\Demo\SecondFox"):-File("fox.txt","\windows\fox2.txt")
And here’s how the final folder structure looks for the running device image.
Fairly straight forward to rename/map files into the appropriate place – perhaps this is functionality I should add to the CEFileWiz application…