If you haven’t noticed already, all of the files that you put in the Windows CE OS image end up in the \Windows folder. There is nothing that you can do about that, but you can creates other folders and copy files into those folders using DAT files.
DAT files can be somewhat of a mystery because most BSPs don’t do anything with them and the default OSDesigns don’t include anything in the project.dat file. But, the DAT files in the Public folders do include plenty of examples and Platform Builder Help does a good job of documenting the files.
Before going on, this word of caution: the only thing that you can do with files in DAT files is copy them. This means that you will be using extra RAM in your system to hold the copy of the file. So the cost of the RAM use must be taken into consideration.   For executables, you can include a shortcut in the OS that you copy which gives the same look and feel, but uses less RAM.
The commands, or file parameters, in DAT files are:
·         root, which designates the root folder
·         Directory(“<Directory name>”), which is used to both designate a folder and to create a new folder
·         Permdir(“<Directory name>”), which is used to create a new folder that cannot be deleted by the user
·         File(“<destination file name>”, “<source path and file name>”), which is used to copy a file
Create a folder
You can use DAT files to create a folder, or folder tree. This is exactly what the DAT files in the Public folders do to create the directory structure that you see when you boot your system.
Example of creating \MyFolder\SubFolder using Project.dat:
root:-Directory("MyFolder")
Directory("\MyFolder "):-Permdir("SubFolder ")
Which does the following:
1.       Creates a folder named MyFolder in the root of the file system.
2.       Creates a folder named SubFolder in \MyFolder which cannot be deleted
It is a little interesting that Directory() is used in two ways; one to create a directory, and the other to specify a folder in which the new directory will be created.
Copy a File to a Folder
You can also use DAT files to copy files from the \Windows folder to one or the newly created folders.
Example of copying MyApp.lnk to \MyFolder\SubFolder:
Directory("\MyFolder \ SubFolder "):-File("MyApp.lnk", "\Windows\ MyApp.lnk")
Which copies \Windows\MyApp.lnk to \MyFolder\SubFolder\MyApp.lnk But what if you want to rename the file?
Directory("\MyFolder \ SubFolder "):-File("MyNewName.lnk", "\Windows\ MyApp.lnk")
Which renames MyApp.lnk to MyNewName.lnk when it copies it to \MyFolder\MySubfolder.
 
Copyright © 2008 – Bruce Eitman
All Rights Reserved