Check if data file exists?Solved
I would like to check if the file example.json exists in data/{Name}/commands/ .
Is it possible? I tried two times but noone is working...

void OnUserGroupAdded(string player, string groupName)
{
    if (Interface.Oxide.DataFileSystem.ExistsDatafile($"{Name}/commands/{groupName}") == true)
    {
        Puts("Exist!");
    }
    else
    {
        Puts("NO!");
    }
}


CommandsPluginData commandsDataFile;
class CommandsPluginData
    {
        public int inventorySlotsNeeded;
        public List<string> commands = new List<string>();
    }

void OnUserGroupAdded(string player, string groupName)
{
    try
        {
            commandsDataFile = Interface.Oxide.DataFileSystem.ReadObject<CommandsPluginData>($"{Name}/commands/{groupName}");
        }
    catch (Exception e)
        {
            PrintError(e.ToString());
        }
}​
The first one should work as I use it
Interface.Oxide.DataFileSystem.ExistsDatafile(path)

Just check if path is correct. I think that the final file should be without .json extension. So the path should be "myfolder/myfile"
5d2e4d835505b.png Ultra
The first one should work as I use it
Interface.Oxide.DataFileSystem.ExistsDatafile(path)

Just check if path is correct. I think that the final file should be without .json extension. So the path should be "myfolder/myfile"

Thank you for your answer! It's now working, I made a mistake in my code :)

Locked automatically