本文介绍了WindowsXP 和 Windows Vista 中不同的 Application SpecialFolders 指向哪些目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即我有:

  • Environment.SpecialFolder.ApplicationData
  • Environment.SpecialFolder.CommonApplicationData
  • Environment.SpecialFolder.LocalApplicationData

我不清楚这些是否指向 Windows XP 和/或 Windows Vista.

I am unclear as to were these point to in Windows XP and/or Windows Vista.

到目前为止,我发现 ApplicationData 在 XP 中指向当前用户的 ApplicationData 文件夹,在 Vista 中指向漫游应用程序数据文件夹.

What I found so far is that the ApplicationData points to the ApplicationData Folder for the current user in XP and the roaming application data folder in Vista.

我也想知道是否有关于何时使用哪个的一般准则.

I would also like to know if there are general guidelines on when to use which.

推荐答案

对此没有唯一的答案.事实上,这正是为什么定义这些SpecialFolder"的原因.您使用这些而不是硬编码路径.

There's no single answer to that. In fact, that's precisely why these "SpecialFolder"s are defined. You use those instead of a hardcoded path.

Environment.SpecialFolder.ApplicationData 是最常见的一种.此文件夹包含每个用户的非临时应用程序特定数据,而不是用户文档.一个常见的例子是设置或配置文件.

Environment.SpecialFolder.ApplicationData is the most common one. This folder holds per-user, non-temporary application-specific data, other than user documents. A common example would be a settings or configuration file.

Environment.SpecialFolder.CommonApplicationData 类似,但在用户之间共享.例如,您可以使用它来存储文档模板.

Environment.SpecialFolder.CommonApplicationData is similar, but shared across users. You could use this to store document templates, for instance.

Environment.SpecialFolder.LocalApplicationData 是 ApplicationData 的非漫游替代方案.因此,您永远不会在那里存储重要数据.但是,因为它是非漫游的,所以它是临时文件、缓存等的好位置.它通常在本地磁盘上.

Environment.SpecialFolder.LocalApplicationData is a non-roaming alternative for ApplicationData. As such, you'd never store important data there. However, because it's non-roaming it is a good location for temporary files, caches, etcetera. It's typically on a local disk.

这篇关于WindowsXP 和 Windows Vista 中不同的 Application SpecialFolders 指向哪些目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 11:51