if (!Files.Exists("Rewards"))
{
Files.WriteObject("Rewards", RewardsData.DefaultRewards());
}
Exception: Access denied. Path must be within 'umod' directory
What is Files provided by? The error means you'd need to specify a path under the umod directory.
PluginFiles Files in class Plugin
Going off documentation here. https://umod.org/guides/the-basics/filesystem#directory-helpers
You likely need to specify either a file extension or append a file with Rewards/ as the prefix.
So is the path not already pointing to umod, im not sure i understand, adding .json results in the same error.
2:33 AM [Error] Failed to call hook 'Loaded' on plugin 'Voter v0.0.1' (Exception: Access denied. Path must be within 'umod' directory! File: Voter\Sites.json)
Using
if (!Files.Exists("Sites.json"))
{
Files.WriteObject("Sites.json", RewardsData.DefaultRewards());
}
I'm not really familiar with that API yet, so I'm only assuming. I'd need to take a look at it when I get a chance, but it sounds like it is defaulting to somewhere it shouldn't be. For now, you can try setting the full path from your server root, which would likely be umod/data/filename.
same problem :(