I'm working on a plugin that will create a new json file in the data folder. After creation it will be loaded along with all the database files.
My problem is that until the code in the plugin is run to populate and save this file, it won't exist.
Is there a way I can override this part of the DataManager.loadDataFile so if my particular file doesn't exist, it just creates an empty object, without having to rewrite that function?
xhr.onerror = function() {
DataManager._errorUrl = DataManager._errorUrl || url;
};
I am trying to avoid plugin users having to create that file manually.
Edit: I suppose I could just do a fs.existsSync test to see if the file is there, and create it if it isn't, rather than worrying about handling a missing file when loading the database.
My problem is that until the code in the plugin is run to populate and save this file, it won't exist.
Is there a way I can override this part of the DataManager.loadDataFile so if my particular file doesn't exist, it just creates an empty object, without having to rewrite that function?
xhr.onerror = function() {
DataManager._errorUrl = DataManager._errorUrl || url;
};
I am trying to avoid plugin users having to create that file manually.
Edit: I suppose I could just do a fs.existsSync test to see if the file is there, and create it if it isn't, rather than worrying about handling a missing file when loading the database.
Last edited by a moderator:
