Путь к файлу C# winform
I have the test.txt file I embed in the prj and then I use FileStream > I want to put this test.txt file in this path \ Game \ ya \ <the test.txt file it is in, This path is before the default, it is located on drive C: \ Game \ ya \ but if it is on D: \ Game \ ya \ or E, F, ... or each computer is different then how could I find the correct path \ Game \ ya \ Is there any way for it to find the path to put the file tes.txt in the path, not using OpenFileDialogs?
private void button2_Click(object sender, EventArgs e) { Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("wf2.test.txt"); // string fullPath1 = @"\Game\ya\test.txt"; // FileStream fileStream = new FileStream(fullPath1, FileMode.Create); for (int i = 0; i < stream.Length; i++) fileStream.WriteByte((byte)stream.ReadByte()); fileStream.Close(); MessageBox.Show("Install successfully"); }
Что я уже пробовал:
<pre> // string fullPath1 = @"\Game\ya\test.txt"; //
It seems that it is only correct on the Windows drive