如何在 LocalApplicationData 下构造文件夹?
我正在研究具有枚举的特殊文件夹,例如 LocalApplicationData。在我的 Windows 7 计算机上,我看到了其中的内容,首先我看到了几个 GUID 子文件夹。我不知道它们是什么,并推测它们是微软出于某种目的而放入的东西。
接下来,我看到以各个公司命名的文件夹,例如 Adobe、Apple、Citrix、Microsoft 等。但是,当我进入每个子文件夹时,我会看到更多子文件夹,例如在 Adobe 下,我看到名为Acrobat、Color、Reader 9.3 和 Updater6。那么,当我重新编写我们的应用程序时,我是否采用类似的结构,例如 \OurCompany\App1、\OurCompany\App2 等?或者我们可以将所有各种应用程序数据放入\OurCompany 中吗?我要问的是标准程序或最佳实践是什么?
I’m looking into the special folders which have enumerations, such as the LocalApplicationData. On my Windows 7 machine I’ve seen what’s there, and first I see several sub-folders that are GUID’s. I’ve no idea what they are, and presume them to be something that Microsoft puts in for whatever.
Next I see folders named after various companies, like Adobe, Apple, Citrix, Microsoft, etc. However, when I go into each of these sub-folders I’ll see more sub-folders, e.g. under Adobe I see sub-folders named Acrobat, Color, Reader 9.3 and Updater6. So when I go to re-write our application, do I adopt a similar structure, something like \OurCompany\App1, \OurCompany\App2, etc.? Or can we just put all of our various applications data into \OurCompany? What I’m asking for is what is standard procedure, or best practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的公司只生产一种产品,并且只有一种版本,那么结构并不重要 - 但最好计划更积极的结果:)
正如您从其他公司/产品中看到的那样您已经安装了,具有包含公司名称、产品名称和可能版本的文件夹结构将有助于避免冲突。您可以避免使用文件夹,而只使用一些文件名约定,但您可能会发现将来需要多个文件,并且从文件夹开始更简单。它们花费不多。
至于是否包含版本号,关键问题在于同一产品的多个版本同时共存是否有意义。并非所有产品都需要此功能,某些应用程序将升级设置或具有读取旧格式数据的代码。请记住,漫游区域下的数据(ApplicationData 而非 LocalApplicationData)可能对安装在不同计算机上的同一应用程序的不同版本可见。
If your company only makes one product and there is only going to be one version of it, then the structure doesn't matter - but it is better to plan for a more positive outcome :)
As you have seen from the other companies/products you have installed, having a folder structure that includes the company name, product name, and possibly version will all help to avoid clashes. You could avoid using folders and just use some file name convention, but you may find that you need multiple files in the future and it is simpler to start off with folders. They don't cost much.
As for the question of whether to include the version number or not, the key issue is whether it makes sense to have multiple versions of the same product co-existing at the same time. Not all products need this and some apps will upgrade the settings or have code to read data in the old format. Bear in mind that for data under the roaming area (ApplicationData not LocalApplicationData) may be visible to different versions of the same application installed on different machines.