Easy Storage 4.0 Problem

Dec 10, 2011 at 7:12 PM

Hello! I added easy storage to my project and noticed that there was not a method to create a directory, so I went to SaveDeviceSynchronous.cs and added this:

public void CreateDirectory(string containerName, string folder) 
        { 
            VerifyIsReady(); 
 
            // lock on the storage device so that only one storage operation can occur at a time 
            lock (storageDevice) 
            { 
                // open a container 
                using (StorageContainer currentContainer = OpenContainer(containerName)) 
                { 
                    currentContainer.CreateDirectory(folder); 
                } 
            } 
        } 
That works fine. But now I want to delete a directory, so I added this:
public void DeleteDirectory(string containerName, string folder) 
        { 
            VerifyIsReady(); 
 
            // lock on the storage device so that only one storage operation can occur at a time 
            lock (storageDevice) 
            { 
                // open a container 
                using (StorageContainer currentContainer = OpenContainer(containerName)) 
                { 
                    currentContainer.DeleteDirectory(folder); 
                } 
            } 
        } 

It works when I create a directory, but when I try to delete a directory, I get a System.IO.IOException (Picture) on this line:
currentContainer.DeleteDirectory(folder); 
The call stack also led me here:
private void delete(IAsyncResult r) 
        { 
            int? index = Guide.EndShowMessageBox(r); 
 
            if (index == 0) 
            { 
                //HERE Global.SaveDevice.DeleteDirectory(Global.containerName, Path.GetFileNameWithoutExtension(worlds[selectedEntry - 2])); 
                MenuEntries.Remove(MenuEntries[selectedEntry]); 
            } 
        } 
I also added a method to get directories and it works fine:
 string[] worlds = Global.SaveDevice.GetDirectories(Global.containerName); 
I tried everything to get my DeleteDirectory method working. I just can't figure it out! I saw in my locals, it said 
InnerExecption: Could not evaluate expression
Any help?