Your code has a couple of problems:
as any
cast- Accessing the app variable from window instead of using the plugin instance.
- Using the
path
andfs
libraries, these are desktop only. - Hardcoding
.obsidian
, the folder path can be changed in the settings of Obsidian.
And using /
is correct when using Obsidian API’s, it’s the same on all platforms.
All of the above can be avoided if you just take a look at the same plugin and the loadSettings
and saveSettings
functions.
Those save the settings
object data into the data.json
file.