Paula is mentioning this during her MDC presentations but it’s something all Smartphone developers should be aware of…
On Smartphone 2002 you had to store your files withing the \IPSM directory to prevent your files from disappearing upon reboot. On Smartphone 2003 this was changed to \Storage. In the next version, there is a good chance that this is going to change one more time (sorry).
So how can you ensure that your application is storing files in a location that doesn’t disappear when the device is turned off or the battery goes dead? Simple: don’t hard code paths.
Instead of hard coding paths like \Storage and \IPSM into your application, you should always always always ask the OS where you can safely put files. This is done by using the SHGetSpecialFolderPath API with the CSIDL_PERSONAL parameter. Google makes it easy to find VB.NET and C# wrappers for this.
To ensure that your Smartphone applications do the right thing in the future, start using this function in your code today.
[Author: Robert Levy]