Hello i have a problem, i created a directory and a file in that directory. And i want to save something to this file but i got a error:
IOException: Sharing violation on path.
This is my code:
path_md=System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
path_md = path_md + "/Gladiator";
Directory.CreateDirectory(path_md);
path_md = path_md + "/character_stats.txt";
File.Create(path_md);
lines = new string[3]; I declared a array above with that: public string[] lines;
lines[0] = "dadad";
lines[1] = "adasdasd";
lines[2] = "adadadadadadad";
File.WriteAllLines(path_md,lines);
Debug.Log("after");
The folder and a file are created but i can’t write something to it:( Should i close that file or something, i just don’t know, instead of a File.WriteAllLines i tried using a StreamWrite but i got the same error:(