Jackery Xu
Jackery Xu

Reputation: 402

How do I create an unspecified file path

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

Answers (1)

Reacher Gilt
Reacher Gilt

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

Related Questions