Subscribe to the RSS feed then follow me on twitter at @mrlacey (misc) and @wpug (WPDev news)

Wednesday, January 23, 2008

EDSK ... not to make assumptions about a file system

Every developer should know not to make assumptions about a file system.

Don't assume that certain folders or drives will ever exist on the machine your software will be deployed on.

Also, don't assume you will have permission to access a location.

Why is this important?

If you assume a certain drive or folder will exist, or you have permission to access it but it doesn't or you don't. You software is likely to fail in unpredicted ways.

What do you do once you know this?

Test all assumptions. In code.
Want to install to the C drive? Test it exists first.
Want to write a file to a particular directory? Check it exists and you have permissions to write to it.


What do you think?
Is this something every developer should know? Have you say in the comments.

Are you a Windows Phone developer? If so, you could be getting rewards for the apps you build and the success they achieve by joining Nokia's DVLUP program.

No comments:

Post a Comment