DAT檔案用於在WinCE啟動的時候,定義檔案系統的結構,也就是定義有哪些檔案夾,哪些檔案在什麼位置等。每次冷啟動的時候,Filesys模組會根據.dat檔案中的內容來建立目錄以及目錄下的檔案。
在BSP中我們可以找到platform.dat。在建立一個WinCE的工程以後,可以在工程目錄下面找到project.dat。可以在這兩個.dat檔案中定義我們所需的根目錄以及相應的子目錄和檔案,當然Windows檔案夾及其包含的子檔案夾除外。使用者可以通過定義捷徑的方法來引用Windows目錄下的檔案。
關於DAT檔案的具體格式,來舉個例子:
root:-Directory("My Documents")
root:-Directory("Program Files")
Directory("\Program Files"):-Directory("My Projects")
Directory("\Program Files"):-Directory("Accessories")
Directory("\Program Files"):-Directory("Communication")
Directory("\Program Files\My Projects"):-File("My Project Program", "\Windows\Myproj.exe")
root:-File("\control.lnk", "\Windows\control.lnk")
簡單解釋一下,上面的內容是先建立My Documents和Program Files兩個根目錄,然後在Program Files下面建立My Projects,Accessories和Communication三個子目錄,然後拷貝被定義在Windows目錄下的存在於ROM中的Myproj.exe檔案到My Projects目錄下面,且名字為My Project Program。這裡需要說明的一點就是,像Myproj.exe這樣的檔案都是從ROM中拷貝出來的,所以必須在BIB檔案中包含了該檔案。最後一行意思是在根路徑下建立control.lnk,該檔案來自ROM中的control.lnk檔案,是一個捷徑檔案。
對上面的一些格式做個解釋:
1.Root Directory的文法格式:
root:[-Directory("dir_name")] [-Permdir("dir_name")]
[-File("target_filename", "source_location")]
root:表示根目錄。
-Directory(“dir_name”):定義根目錄下的目錄名。
-Permdir(“dir_name”):定義一個永久的目錄,使用者是不能通過RemoveDirectory函數刪除的。
-File(" target_filename", " source_location"):定義一個目標檔案,該檔案從ROM中拷貝過來。target_filename為目標檔案的檔案名稱,source_location為ROM中的檔案,指Windows目錄下的某路徑下的檔案名稱。
2.Directory的文法格式:
Directory("dir_name"):[-Directory("dir_name")]
[-File("target_filename", "source_location")]
Directory(“dir_name”):表示目錄名。”\”表示根目錄。
-Directory(“dir_name”):表示目錄下的路徑,就是子目錄。
-File(" target_filename", " source_location"):定義一個目標檔案,該檔案從ROM中拷貝過來。target_filename為目標檔案的檔案名稱,source_location為ROM中的檔案,指Windows目錄下的某路徑下的檔案名稱。
DAT中所使用的文法定義比較簡單,看看例子就知道如何修改了,一般我們會通過修改project.dat和platform.dat來改變WinCE啟動後的檔案路徑結構。其中platform.dat是和平台相關的,而project.dat是和WinCE工程相關的。