Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的插件资源中有一个 xml 配置文件。每当插件中发生某些事件时,我都想更新此文件。我找到了一些方法来查找和读取位于我的插件类路径中的文件的内容,但我正在寻找一种写入此类文件的方法。
有什么办法吗?
非常感谢。
该位置(安装目录)是只读的,因为它可以在网络安装方案中共享。我建议您改为将 XML 文件写入插件的状态位置,该位置仅用于此目的:
String path = Activator.getDefault().getStateLocation().toString();
我应该补充一点,这为您提供了 Eclipse 为您的插件想要存储的任何文件创建的目录的完全限定路径。这个目录对你的插件来说是唯一的。