read_file, delete_file, and write_file

Deprecated some uses of load_app_data and store_app_data
This commit is contained in:
gnembon committed 2020-06-07 01:52:38 -03:00
1 parent b3484fd012
commit fb3a5cfa64
7 files changed
+351 -55

No files matched your search

@@ -369,7 +369,7 @@ public class CarpetScriptHost extends ScriptHost
return Module.getData(main, null, false);
}
public Tag getGlobalState(String file, boolean isShared)
public Tag readFileTag(String file, boolean isShared)
{
if (getName() == null && !isShared) return null;
if (file != null)
@@ -379,7 +379,7 @@ public class CarpetScriptHost extends ScriptHost
return ((CarpetScriptHost)parent).globalState;
}
public boolean setGlobalState(Tag tag, String file, boolean isShared)
public boolean writeTagFile(Tag tag, String file, boolean isShared)
{
if (getName() == null && !isShared) return false; // if belongs to an app, cannot be default host.
@@ -398,6 +398,25 @@ public class CarpetScriptHost extends ScriptHost
return true;
}
public boolean removeResourceFile(String resource, boolean isShared, String type)
{
if (getName() == null && !isShared) return false; //
return Module.dropExistingFile(main, resource, type.equals("nbt")?"nbt":"txt", isShared);
}
public boolean appendLogFile(String resource, boolean isShared, String type, List<String> data)
{
if (getName() == null && !isShared) return false; // if belongs to an app, cannot be default host.
return Module.appendToTextFile(main, resource, type, isShared, data);
}
public List<String> readTextResource(String resource, boolean isShared)
{
if (getName() == null && !isShared) return null; //
return Module.listFile(main, resource, "txt", isShared);
}
public void tick()
{
if (this.saveTimeout > 0)