Jump to content
  • entries
    945
  • comments
    5,899
  • views
    930,314

Not So Fast


Josh

2,939 views

 Share

In my previous blog I talked about the Android file system and APK package system. The end result was I copied all the project assets into the res/raw folder. However, I learned two additional things that changed my plan a little:

  • Android files can only be lower-case.
  • Any folders in the res/raw folder will not get copied...it just packs in the files in that directory, with no sub-directories!

That's a big problem if we want Leadwerks to be able to load files the same on each operating system,but I came up with a solution. In the asset copy step, took the asset files and gave them a random name like "jfuendjhgdjkhfndlrhgjfkd". I stored their original path and their new nonsensical path in a text file. When the engine starts, it reads this text file and sets the files up in a virtual file system, so calling Model::Load("Models/Characters/Goblin.mdl") will load the gobbly-gook file behind the scenes, and the user will never know the difference.

 

This is implemented and it works right now. I'm going to try to automate the final publishing step as much as possible to save everyone time.

 

I also learned how to change the name of the Android application so we can just auto-generate the Eclipse project for you based on the values you enter in the project creation wizard.

  • Upvote 1
 Share

6 Comments


Recommended Comments

One small change I am going to make this morning is to leave the file names the same, by default, unless a duplicate file name is encountered. If that happens it will have a dash and number added to the end like this:

truck.mdl

truck-2.mdl

 

I think this might turn out to be handier in some situations, and it works the same. It will check for existing file names, so if you really do have a file with that name, it will increment the suffix and check again.

Link to comment

You guys won't believe this. You actually can't have two files with the same name, ignoring the file extension. For example, you can't use both "goblin2.tex" and "goblin2.mdl". I guess my original random name design was best. :D

Link to comment

Extension is just a part seperated by any character. Nowhere it is said you should use "." as extension seperator, but you could use as well "-" or ":", etc....

So "goblin2_tex", "goblin2#tex" or "goblin2@tex" should work?

Link to comment

Yeah, but at that point, does it matter whether the file name is goblin2-3_tex or FIDHJDJHFKJDF? You can just run the publish tool from the editor again if you want to modify something. I don't really expect people will be poking around in the projects/android/res/raw folder anyways.

Link to comment

Of course, if the real file name does not matter to the user, it can be anything. But maybe sometimes some debugging is needed, and then a human-readable filename hint would help a lot?

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...