SteveDunn / Gleed2D

Generic Level Editor 2D
83 stars 28 forks source link

Error Initializing Texture - File Doesn't Exist #8

Closed tylerrrr07 closed 12 years ago

tylerrrr07 commented 12 years ago

I encountered an issue on load where textures would not properly initialize. It seems that after the error messages all go away (once for every single texture in the level) the textures seem to load ok but its very annoying. This issue also crops up upon placing textures within the level.

From what I can tell via debugging and the error provided is that this is an issue of the texture item's relative path also containing the parent folder.

For Example:

Content Root Folder: C:\Project\Content Content Root Folder contains a sub folder called "Sprites" and as such texture item's relative path should be: Sprites/file.ext Error message states it can't find the file: C:\Project\Content\Content\Spites\file.ext (notice the duplicate entry for "Content")

In debugging I was able to find that within the initialiseTexture method of the TextureItemEditor.cs file, the parameter textureFileName was "Content\Sprites\file.ext" - I traced this up a few steps and found it came from some properties collections and got nervous about changing anything much further and decided to post my findings here.

SteveDunn commented 12 years ago

Hi there, could you provide your level file and texture folder? Thanks for the feedback and I'll get right on it. Cheers, Steve. steve@dunnhq.com

SteveDunn commented 12 years ago

This looks to be because the 'content root folder' doesn't have a trailing back-slash, so .NET is assuming it's a file and not a folder. I'll fix this so that it forces the trailing slash.

SteveDunn commented 12 years ago

This should now be fixed. Please let me know if you're still having issues with it.

SteveDunn commented 12 years ago

I'm closing this, but do let me know if there's still an issue

tylerrrr07 commented 12 years ago

Looks to be resolved. Thanks!