程序输出文件的标准文件夹
我正在编写一个工具,可能会要求它在文本文件中生成结果。在 Windows 7 上,我希望将该工具安装在 Program Files 中,但显然我无法在那里写入,并且询问用户在哪里保存文件是多余的。我想知道是否有一种常见的做法(类似于 %AppData% 的标准文件夹)可以在其中写入输出文件。
谢谢,
奥伦
I'm writing a tool that may be asked to produce its results in a text file. On Windows 7 I want the tool to install in Program Files, but I obviously can't write there, and asking the user where to save the file is overkill. I was wondering if there's a common practice (a standard folder similar to %AppData%) in which I can write output files.
Thanks,
Oren
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的最佳实践是 AppData 下的某些内容,如果用户永远不需要查看它(例如,您有 UI 来管理的设置),以及“我的文档”下的某些内容,如果用户确实需要查看它(找到它,通过电子邮件发送给人们,用另一个人打开)应用程序等)但是,在这种情况下,我通常更喜欢让用户指定路径,它只是默认为“我的文档”下的某些内容。另外,在您的应用程序中添加一个按钮,该按钮将打开 Windows 资源管理器到保存文档的路径 - 对于您和满意的用户来说,这并不需要太多工作。
很容易,是吗?
My best practice is something under AppData if the user never needs to see it (eg settings that you have UI to manage) and something under My Documents if the user does need to see it (find it, email it to people, open with another app etc.) However I generally prefer to let the user specify the path in that case, with it just defaulting to something under My Documents. Also, add a button in your app that will open a Windows Explorer to the path where the doc is saved - not much work for you and happier users.
Easy enough, eh?