Skip to content

Commit

Permalink
Merge pull request #18 from KasugaLibGroup/gui
Browse files Browse the repository at this point in the history
fix: gui prod
  • Loading branch information
TimeBather authored Nov 30, 2024
2 parents 8c03c33 + 4ac55ab commit 84c6e57
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/main/java/kasuga/lib/core/addons/node/AssetReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ public class AssetReader implements BiFunction<String, String, String> {
private final HashMap<UUID, Object> assets;
private final JavascriptContext context;
private final String dirname;
private final String assetRoot;

ResourceProvider provider;

public AssetReader(String dirname, JavascriptContext context, ResourceProvider provider, HashMap<UUID, Object> assets) {
public AssetReader(String dirname, JavascriptContext context, ResourceProvider provider, HashMap<UUID, Object> assets, String assetRoot) {
this.provider = provider;
this.context = context;
this.assets = assets;
this.dirname = dirname;
this.assetRoot = assetRoot == null ? "/" : assetRoot;
}

@HostAccess.Export
Expand All @@ -45,6 +47,16 @@ public String apply(String path, String resourceType){
)
);
}
path = PackageScanner.joinPath(
PackageScanner.resolve(
PackageScanner.splitPath(
assetRoot
),
PackageScanner.splitPath(
path
)
)
);
UUID uuid;
do{
uuid = UUID.randomUUID();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ protected JavascriptEngineModule load(
module.getDirectoryName(),
javascriptContext,
moduleInfo.getProvider(),
KasugaLib.STACKS.JAVASCRIPT.ASSETS.get()
));
KasugaLib.STACKS.JAVASCRIPT.ASSETS.get(),
"/"));
return module;

}catch (IOException e){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public JavetJavascriptModule(
directoryName,
context,
nodePackage.reader,
KasugaLib.STACKS.JAVASCRIPT.ASSETS.get()
KasugaLib.STACKS.JAVASCRIPT.ASSETS.get(),
nodePackage.minecraft.assetsFolder()
): null, absolutePath, directoryName, context);
}
public JavetJavascriptModule(
Expand All @@ -53,6 +54,7 @@ public JavetJavascriptModule(
this.nodePackage = nodePackage;
this.directoryName = directoryName;
this.context = context;
this.assetReader = reader;
}

public JavetJavascriptModule(
Expand Down

0 comments on commit 84c6e57

Please sign in to comment.