[SOLVED] Get all files in the content directory


Currently porting my app to Android. While
worked on UWP like a dream, it does not work on Android. I guess because on Android it starts from the root folder of your phone.

How am I able to get all files out of my ‘content’ folder?
My aim is to get all .xml files in my content (or sub) folder to load them on demand.

The path:
Has no content folder. Parent folder of ↑ has ‘cache, data and lib’ as a subfolder. Can’t find the content folder.

Thanks in advance.

Checked the sourcecode of MonoGame and found the solution here

Toemsel92, if you see this, I’m facing exactly the same problem.
How do you call that function from C# and what parameter you should pass to “safename”?

Hope you can see this! Thanks.

Long time ago, but I managed to find the project. I used a .XML file to store all the asset locations. (I did write a program which writes all content files (with their location) into an XML. Thus, If I load the XML, I can read all existing files.

XmlReader xmlReader = XmlReader.Create(TitleContainer.OpenStream(@"Content/Data/Items/ItemDB.xml"));

1 Like

Thanks so much for replying, Toemsel! I’m sorry I forgot to update the thread, but I did find the solution which is basically what you posted. However, I ended up changing the way I load the assets, and now I only load what is needed. I’m sure your reply will help somebody else in the future.