Refactor Module into a single record type and fix system globals (#1383)

This commit is contained in:
altrisi authored and GitHub committed 2022-05-17 20:11:49 +02:00
1 parent d681cb4c54
commit a60bc386cb
20 files changed
+279 -215

No files matched your search

@@ -2,7 +2,7 @@ package carpet.script.argument;
import carpet.CarpetServer;
import carpet.script.CarpetScriptServer;
import carpet.script.bundled.Module;
import carpet.script.Module;
import carpet.script.exception.InternalExpressionException;
import carpet.script.exception.ThrowStatement;
import carpet.script.exception.Throwables;
@@ -177,7 +177,7 @@ public class FileArgument
private Path toPath(Module module)
{
if (!isShared && (module == null || module.getName() == null)) return null;
if (!isShared && module == null) return null;
if (zipContainer == null)
return resolve(getDescriptor(module, resource)+(isFolder?"":type.extension));
else
@@ -204,8 +204,8 @@ public class FileArgument
private Path moduleRootPath(Module module)
{
if (!isShared && (module == null || module.getName() == null)) return null;
return resolve(isShared?"shared":module.getName()+".data");
if (!isShared && module == null) return null;
return resolve(isShared?"shared":module.name()+".data");
}
public String getDisplayPath()
@@ -219,9 +219,9 @@ public class FileArgument
{
return res.isEmpty()?"shared":"shared/"+res;
}
if (module != null && module.getName() != null) // appdata
if (module != null) // appdata
{
return module.getName()+".data"+(res==null || res.isEmpty()?"":"/"+res);
return module.name()+".data"+(res==null || res.isEmpty()?"":"/"+res);
}
throw new InternalExpressionException("Invalid file descriptor: "+res);
}