Identifying Persistent Directories in CE

  • Thread starter Thread starter Dave Hall
  • Start date Start date
D

Dave Hall

How can I determine if a particular directory on my CE.NET 4.2 device will
persist through a reboot? For example, the default deployment target for
VS2003 is /Program Files/MyProject. After deploying my project to this
folder and rebooting the device, the MyProject folder no longer exists.
There are several folders that I can copy my application into which will
persist through a reboot, but the names of those folders is different for CE
devices from different vendors. I'm trying to find out if there is an API
call that will identify if the directory that I'm executing from (or any
directory specified) will still be around after I reboot. If my app is
running in a directory that will not survive a reboot, then I want to notify
the user. I'm looking for something like this:

if(!DirectoryWillSurviveReboot(System.Reflection.Assembly.GetExecutingAssemb
ly().GetName().CodeBase)
{
NotifyUser("Asssembly will be deleted at next reboot");
}

Any ideas how to determine this info?

Thanks,
Dave
 
You are looking for a way to detect a storage card (flash memory). A
simplified way to do it is to check directory attributes for ReadOnly. A
better way is to use FindFisrtFlashCard/FindNextFlashCard API
 
On some vendors hardware, I have to run from Compact Flash. In others, I'm
running from built-in flash and there is no compact flash card. In either
case, I'm trying to identify a directory that's not automatically
regenerated by the nk.bin operating system image after a reboot. For
example, if I add a new directory under "\windows", then reboot, the new
directory will no longer exist. The same is true for "\Program Files". When
I first open "My Computer" in CE, there are several folders that have
distinctive icons that look like folders with what might be a compact flash
on them. If I create a folder in some of them, it will still exist after a
reboot. Some of them though (specifically one named "\Network") won't let me
create a folder under it, but that's a seperate issue.

The problem is that I don't know how to programatically identify if a
particular path is in one of these "special" folders. Checking for ReadOnly
attribute on the top level folder might do the trick.
FindFirstFlashCard/FindNextFlashCard might even do the trick too, but the
API name doesn't sound quite right for what I'm trying to do. You've given
me some good suggestions though. I'll let you know how they work out.

Thanks.
Dave
 
Back
Top