Best way to load multiple folders into a resource load manager

I have story objects that are written in XML and each story is contained in a folder that contains 3 XML files: the main story file, the node file, and the choice file. Currently, the manager reads each file as a large unified file (e.g. the story file has multiple stories, the node file has all nodes for all stories in the game, etc) What I would like to do is find a way to be able to read unique folders that each contain the files needed for just that story, in other words:

Story1

->StoryXML

->NodeXML

->ChoiceXML

Story2

->StoryXML

->NodeXML

->ChoiceXML

etc.

This seems like it should be pretty simple but I’m not sure how to check for and iterate through each separate folder. TIA for any help!

Steve

Well, I figured it out for myself. It’s a little ungainly, but it works perfectly, and there is try/catch code in each sub function if the folder does not contain one or more files (it marks the entire story as invalid and continues the loop). This is what I did:

public static void LoadAllStoryFolders()
    {
        IEnumerable<string> storyFolders = Directory.GetDirectories(Application.dataPath + "/Resources/Story Data/", "story*", SearchOption.TopDirectoryOnly);
        foreach (string fn in storyFolders)
        {
            string[] str = { "Resources/" };
            string[] pathString = fn.Split(str, System.StringSplitOptions.RemoveEmptyEntries);
            string folderName = pathString[1];
            Debug.Log("Reading Story Folder " + folderName);
            ReadStoryFiles(folderName);
            ReadStoryChoiceFiles(folderName);
            ReadStoryNodeFiles(folderName);
        }
    }

I had to not only find each subfolder but manipulate the path string so that it works to use the resource root, hence the Split function.

Thanks!
-Steve