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

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];
}
}


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)

• stackoverflow.com/questions/52797/… – James Apr 16 '12 at 8:20
• The above link shows you how to get the path to where the exe that is running is currently located. You can then just put the txt file in the same folder or a sub folder from the EXE.. I did not post this as an answer as it seems odd when its just a link to another answer. (Sorry for the double comments. I hit enter when I did not mean to.) – James Apr 16 '12 at 8:22

using (StreamReader sr = new StreamReader("Linije.txt"))

• It's probably in the Content folder. Open your project's folder in Windows Explorer (it's on the right-click menu) and navigate into \bin\x86\Debug. Your compiled project and all its stuff is inside there (plus some .pdb files which are debug files, and not required for redistributing the game). There might be subfolders like a Content folder which will probably contain your file. – doppelgreener Apr 16 '12 at 9:12