Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative paths not allowed when loading files? #136

Open
deccer opened this issue Apr 24, 2022 · 3 comments
Open

Relative paths not allowed when loading files? #136

deccer opened this issue Apr 24, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@deccer
Copy link

deccer commented Apr 24, 2022

Hi,

I have been using relative paths whenever I write something, because it feels very natural and nobody is interfering with any path so far, but SharpGLTF tries to be smart here for no reason. Unless I am wrong.

After finding out how to load an actual file
via

var modelRoot = ModelRoot.Load(fileName, readSettings);

It yelled at me that it can't find the file specified.
In my example the file is sitting in Models/BarberShopChair_01_1k.gltf relative to my .exe (and i confirmed its there, Assimp also has no trouble finding it)

But passing that as fileName yielded the following exception

Could not find a part of the path 'P:\Private\Code\Games\SpaceConflict\src\SpaceConflict\bin\Debug\Models\Models\BarberShopChair_01_1k.gltf'.

It adds another Models layer into my path.

readSettings also does not reveal any mode or option I can set to whatever make it work as is.

Please advise.

@vpenades
Copy link
Owner

Indeed, this is a bug.

Full paths are supported, as loading files directly from the current directory, but it seems relative path make the library crash.

Looking at it.

@deccer
Copy link
Author

deccer commented Apr 26, 2022

Full paths cause some other trouble mentioned in #137 :)

If you need to test something/or have somebody test stuff, feel free to boop me.

@deccer
Copy link
Author

deccer commented Oct 6, 2022

Also apologies for the late reply to this issue.

Indeed relative paths don't work well at all with this library, and for now i simply generate an absolute filepath using Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Relative/Path/Here") which works just fine.

Technically I am not really bothered anymore by this "flaw" but let you decide whether you want to take a look once a gain, or close it for good.

@vpenades vpenades added the bug Something isn't working label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants