I have a weird problem with a text file that I ship with my app.
The file holds a bunch of sites, when the program starts it loads the sites into an array.
On windows 7, when I start the app I don't get any errors. However, on XP I get c:\Document and setting\I\Application Data\fourmlinks.txt file not found.
The weird part is that I made a text file with content with it, and I put it inside the application folder.
This is how I call out in my code:
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\fourmlinks.txt";
My problem is that I can't create a new file because it is holding basic data that the app needs and is using.
After the first launch the user can edit the file as much he wants.
I'm not sure why this is happening, but this is only happening on Windows XP.
How can I solve this problem?
EDIT
keyboardP suggest to check on what windows im runing and then change the path by it. so i came up with this code:
System.OperatingSystem osInfo = System.Environment.OSVersion;
if (osInfo.Platform == PlatformID.Win32NT)
path = Environment.SpecialFolder.LocalApplicationData + "\\fourmlinks.txt";
else
path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\fourmlinks.txt";
the problem that even on windows 7 i get true, when i need to get false. is there a way to make sure i run on XP or Windows 7 i diffrent way?
EDIT 2
using the check of the Operating System, I can now be sure I'm Windows 7 or Windows XP. So, the code run find again on Windows 7 but on Windows XP I get a different error message:
I really have no idea how the path that I add in my program becomes the path that the error is saying I'm requesting.