openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
749 stars 362 forks source link

Uncaught exception: [lime.utils.Preloader] ERROR: There is no asset library with an ID of "default" #1757

Open T1mL3arn opened 5 months ago

T1mL3arn commented 5 months ago
<?xml version="1.0" encoding="utf-8"?>
<project>

    <meta title="TestPath" package="com.sample.testpath" version="1.0.0" company="Company Name" />
    <app main="Main" path="Export" file="TestPath" />

    <source path="Source" />

    <haxelib name="openfl" />

    <assets path="Assets" rename="assets" preload="false"  embed="false"/>

</project>

Asset file

Assets/hello.txt
package;

import openfl.display.Sprite;

class Main extends Sprite
{
    public function new()
    {
        super();

        var f = openfl.Assets.loadText('assets/hello.txt');
        f.onError(e -> {
            trace("ERROR");
            trace(e);
        });
        f.onComplete(text -> {
            trace('LOAD COMPLETE');
            trace(text);
        });

        trace('Main created');
        graphics.beginFill(0xFF0000);
        graphics.drawCircle(200, 300, 50);
    }
}
Uncaught exception: [lime.utils.Preloader] ERROR: There is no asset library with an ID of "default"
Called from lime.utils.$Log.error(lime/utils/Log.hx:37)
Called from lime.utils.Preloader.~updateProgress.3(lime/utils/Preloader.hx:293)
Called from lime.app.Future.onError(lime/app/Future.hx:156)
Called from lime.utils.Preloader.updateProgress(lime/utils/Preloader.hx:241)
Called from lime.utils.Preloader.load(lime/utils/Preloader.hx:183)
Called from $ApplicationMain.create(ApplicationMain.hx:135)
Called from $ApplicationMain.main(ApplicationMain.hx:26)
Called from .init(?:1)

Lime 8.1.1

T1mL3arn commented 5 months ago

I was able to trace it to this

https://github.com/openfl/lime/blob/f8a70444f5d8a6bd3208e2e28b53e57568ba2eee/src/lime/system/System.hx#L457

It returns wrong path if directory contains cyrillic chars.

Placing trace('cwd: ${Sys.getCwd()}'); before this prints desired directory with correct cyrillic name.

--- update

Temp workarounds:

tobil4sk commented 5 months ago

It returns wrong path if directory contains cyrillic chars.

Sounds like it's related to #1472