Storage Location for Module Settings
Hi all,
Sincere apologies if this question has been answered before, but I couldn't find a topic on it, and the docs aren't entirely clear on it either.
I'm in the process of writing a plugin for IntelliJ IDEA, and wish to store some configuration settings for each module. Instead of the .iml, I want to save the settings into a different file. The docs say you can set the relative path where the settings are saved by using a state annotation like so:
@State(
name = "my-settings",
storages = @Storage(value = "myCustomStorageLocation.xml")
)
public class MySettings implements PersistentStateComponent<MySettings> { /**/ }
However, from the best of my observations, this only seems to work for Project Settings. If I try to do the same with module specific settings, IDEA pops up an error message telling me that it cannot find myCustomStorageLocation.xml. For module specific settings, only StoragePathMacros.MODULE_FILE seems to work, or absolute paths, provided the file already exists.
Is it possible to set a custom storage location for module settings? If not, is it intended behaviour?
I'm hoping you can help me. I'm happy to provide additional info if needed. Thanks in advance
-JP
P.S:
When would you use more than one Storage annotation for defining storage locations? I've seen it occasionally, but cannot for the life of me figure out when this is useful. Thanks.
Please sign in to leave a comment.