Reputation: 402
I need to copy file.pdf to the AppData folder in my Winforms app but since this will be used by many people I need to have a generic path that finds
iFile.CopyTo("somethinghere...//AppData//Temp//file.pdf");
and copy the said file.
Upvotes: 0
Views: 215
Reputation: 1813
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
will get the appdata folder for the current user.
If you want a single copy of your PDF for all users, use Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
instead.
MSDN on Environment.GetFolderPath
MSDN on Environment.SpecialFolder
Upvotes: 5