How do I create directories and files within the user's AppData directory?

◇◆丶佛笑我妖孽 提交于 2019-12-04 18:37:37
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
Steven Jeffries

I realize that this question is two years old, but since this is the first result while googling "java store in appdata", I decided to add a correct answer for future googlers.

The question is tagged with Java, and the OP posted Java code, but the accepted answer is .NET (not Java).

Quoted directly from this answer:

System.getenv("APPDATA")

This will give the location to the user's AppData folder (in Windows). You can get a result similar to what the OP wanted by doing the following:

File characterFolder = new File(System.getenv("APPDATA") + "\\" + characterName);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!