Windows CE 5.0, doing the long filename thing.


Long filename support has been around in Microsoft dekstop operating systems for some time, in fact, when you boot Windows CE using the standard “Explorer Shell” you will see shortcuts on the desktop to “Internet Explorer” and “Recycle Bin”, both of these are considered to be long filenames, why? becasue the files don’t fit into the 8.3 format used by MS-DOS, and the filenames contain spaces (how many of you remember having to care about 8.3 filename format?).


So, how do you build an operating system image that contains a long filename file? – actually, the process turns out to be fairly simple.


Let’s assume that you have a file called “Autumn Image.jpg”, and you want to include this into your operating system image, you could start with the tutorial that shows how to add files to your operating system image, unfortunately, CEFileWiz doesn’t currently (and I’m going to work on this) deal with filenames that include spaces, so here’s how to fix this by hand.


Once CEFileWiz has created your project (let’s call the project Autumn_Image) you will have a number of support files for your project, this will include a file called Autumn_Image.bib, here’s how the file looks by default.


;
; Copyright (c) 2005 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
;  ————–  —————————————-  ———–
Autumn Image.jpg    $(_FLATRELEASEDIR)\Autumn Image.jpg       NK


Building the operating system with this BIB file will cause build errors, the build system will parse the BIB entry using the spaces in the filename as a delimiter between the BIB entries, so the quick and easy fix is to add a set of quotes around the filenames, like so…


;
; Copyright (c) 2005 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
;  ————–  —————————————-  ———–
“Autumn Image.jpg”    “$(_FLATRELEASEDIR)\Autumn Image.jpg”       NK


It’s a quick and easy fix to get filenames that include spaces included into your operating system image – look for a CEFileWiz update coming soon – I bet there’s also a problem dealing with spaces in the .DAT files, that’s something else for me to take a look at.


– Mike

Comments (3)

  1. Marcelo van Kampen says:

    Another Feature that i would like to have in CEFileWiz is to set up multiple files in a specific folder of windows CE. Let me say – by example, if you have a web server with multiple files/folders, adding to the image turns to be a tedious task. I Did an script to do this, but it´s still missing some good things like fully recursive directories. Here it is:

    @echo ;This utility was created By Marcelo van Kampen

    @echo ;usage: CreateBIB Directory_base Directory_Destiny

    REM Getting all the SubDirs…

    del DIRS.TMP

    for /R %1 %%d in (.) do @echo %%~fd >>DIRS.TMP

    REM Creating Directory Structures…

    REM FOR /F "eol= " %%d in (DIRS.TMP) do @echo Directory("%%~pd"):-File("STUB")

    REM following each Directory and Printing it´s files…

    DEL OUTPUT.BIB

    echo MODULES>>OUTPUT.BIB

    echo FILES >>OUTPUT.BIB

    FOR /F "eol= " %%d in (DIRS.TMP) do @FOR %%f in (%%d*.*) do @echo %%~nxf $(_FLATRELEASEDIR)%%~nxf NK >>OUTPUT.BIB

    DEL OUTPUT.DAT

    FOR /F "eol= " %%d in (DIRS.TMP) do @FOR %%f in (%%d*.*) do @echo Directory("%2%%~pd"):-File("%%~nxf","windows%%~nxf") >>OUT

  2. mikehall says:

    good idea, I will add it to my list of tweaks.

    – Mike