Pages

Saturday, 6 October 2012

How to check if a file exists in Windows 8

Sometimes things are simple, sometimes they aren't when you think they should be. One such thing in Windows 8 development is checking if a file exists...

In a Windows 8 app (be it C# or JavaScript) you work with the StorageFolder. Since we are sandboxed and don't really have file-system access we don't have the System.IO namespace as we're use to meaning we have an entirely new set of APIs for reading a writing files (although it's nice that they are built around being asynchronous). The fun thing about StorageFolder is it has no method like FileExistsAsync. Yep, there's no API which will allow you to work out whether a file exists or not.

Read More

No comments:

Post a Comment

Web Informer Button