How to get the path of a file after publishing my game

Posted by NDraskovic on Game Development See other posts from Game Development or by NDraskovic
Published on 2012-04-16T07:52:43Z Indexed on 2012/04/16 11:46 UTC
Read the original article Hit count: 540

Filed under:

I made a "game" for a college project that reads data from .txt file at startup and draws some models according to the data in that file. This is the code I use

using (StreamReader sr = new StreamReader(@"C:\Users\User\Desktop\Linije.txt"))                
                {
                    String linija;                    
                    while ((linija = sr.ReadLine()) != null)
                    {
                        red = linija.Split(',');                          
                        model = red[0];
                        x = red[1];
                        y = red[2];
                        z = red[3];
                        elementi.Add(Convert.ToInt32(model));
                        podatci.Add(new Vector3(Convert.ToSingle(x),Convert.ToSingle(y),Convert.ToSingle(z)));
                    }
                }

As you see, this code fills some variables that are then used to define the model that will be drawn and the coordinates where it will be drawn. The problem that I'm having is that I don't know how to distribute that file to other computers (obviously on another computer it would have another path)? Do you have some advices on how to do this? P.S I tried to put it in the Content and set the Build Action on None, and I can see the file in the content directory, but when I change it, nothing happens (the models don't change as they should)

© Game Development or respective owner

Related posts about xna-4.0