这是我的代码。
var storage = IsolatedStorageFile.GetUserStoreForApplication();
if (!directoryPath.StartsWith("/"))
directoryPath = "/" + directoryPath;
if (!storage.DirectoryExists(directoryPath))
{
storage.CreateDirectory(directoryPath);
}
当我调用这个方法时,有时会出现以下异常。
[Type]:[IsolatedStorageException]
[ExceptionMessage]:[Unable to create directory.]
我不知道为什么我会得到这个例外。我的代码有问题吗?它很多时候都很好用,但有时我会感到异常。
请让我知道我的代码中有什么问题。
我收到了这个错误消息。事实证明,我使用的是完整的目录路径,而我本应该使用文件夹名称。
在我将其更改为最后一个文件夹名称后,它停止引发此异常。