Carpet

Carpet

2M Downloads

[scarpet] Failure to read contents of files containig uppercase characters

Firigion opened this issue ยท 2 comments

commented

Steps to reproduce:

  1. Create a script test.sc and a corresponding data directory test.data in a world's scripts folder.
  2. Place a txt file in the data directory with some random contents, testing, for example. Crucially: name the file Test.txt, mind the uppercase T.
  3. Edit test.sc to read from the file like so: print(read_file('Test', 'text'))
  4. When loading the app with /script load test, the app prints null.

Expected behaviour:
When loading the app, it should print testing.

MC version: 1.18.2
Carpet version: 1.4.66

commented

I'm unable to reproduce in 1.18.2 1.4.66
image

commented

I think this may be the cause, not tested yet though:

public static Pair<String,String> recognizeResource(String origfile, boolean isFolder, Type type)
{
String[] pathElements = origfile.toLowerCase(Locale.ROOT).split("[/\\\\]+");
List<String> path = new ArrayList<>();