Afternoon all.
I’m a bit of a novice on this, so please be gentle.
I’m trying to get a level manager that worked ok in XNA to work on
Android. I tested this under Monogame, Windows, OpenGL and worked fine
(obviously, because it has access to the local file system.
Anyway…
So the code looks like this:
string txtline;
System.IO.StreamReader txtfile;
cnt = 0;
string fname = @"C:\Users\Lurch\Desktop\Penetrator2014\WindowsGame1\WindowsGame1Content\" + Global.fileNames[Global.virtualPlayLevelNum];
txtfile = new System.IO.StreamReader(fname);
while ((txtline = txtfile.ReadLine()) != null)
{
processLine(txtline, cnt);
cnt++;
}
Now obviously:
-
The problem is the ‘string fname’
-
It is made up of a hard path + a variable which is goverend elsewhere (that bit seems to work as explained further)
-
Obviously it is never going to work because of the hard path.
-
Debugging throws a “could not find the file “/Level1.txt”.” (which
also tells me the file name variable thats being generated DOES work) -
So basically, how do I get this to reference the correct file once its deployed the the (emulated) device?
-
I’ve tried simply moving the txt files to the root of the project and ditching the path altogether. No luck there.