Reputation: 1
I have a game project where I add a line into .txt
doucument. Then I've created a Setup project for this game. And after installing and running the shortcut on the desktop. And if try to add a line I get an error:
Access to the path
"C:\Program Files\WB\WordsGameSetup\Resources\citiesVocabulary.txt"
is denied.
I've tried two variations of add
method but both don't work.
public void AddWordToVocabulary(string word)
{
File.AppendAllText(Path, word + Environment.NewLine);
Vocabulary.Add(word);
}
public void AddWordToVocabulary(string word)
{
using (var stream = new StreamWriter(new FileStream(Path, FileMode.Append, FileAccess.Write)))
stream.WriteLine(word);
Vocabulary.Add(word);
}
Upvotes: 0
Views: 19