My problem with that would be that if ansca would change one of their libraries my projects would pick this up which is not what I want.
I just tested if Corona works with aliases or softlinks and it does for softlinks.
It also builds correctly with sources as soft-linked files.
So you could use a central place and just do something like this in your projects:
My solution would not cause your projects to pick up the new libraries if you already have the library files in your project folder. The builder would only search the "common" library folder if the library file was missing from the project folder.
Stated a different way, if your project is working now, nothing would change moving to the common library folder.
My implementation of the feature would add an option to the Corona Preferences page where you turn this feature on/off and specify the library folder path.
BTW, thanks for your softlink tip. I'll give it a try.
Tom
I still just think that one would need to parse your source and make assumptions about what your "require" means..
Take this:
1
2
3
4
5
6
7
| if onDevice then
lib='hrtools_device.lua'
else
lib='hrtools_simulator.lua'
end
require(lib) |
I personally second s.w.powers on this one.
@Fogview
Having a single directory for additional/user lua libs while not being able to arbitrarily put *anything* in separate directories would be extremely strange.
Once you can use directories, in general, you can require your "modified" lua libs from any directory, without having Ansca engineers to keep track of single, tiny and specific features like this one to maintain. (and users to learn)
@erpy how would you specify which files need to be part of a build then?
Don't know if I got your question... I'd simply have a folder named after my app with all the sub-directories in it.
If you mean that Corona Lua libs should be built/copied from within the Corona SDK into your app, I'd just rather copy them by hand into my new app... if I need any of them.
This is because:
1) It's not said I'm going to use them, and it's a (tiny) waste on file size
2) I might modify a lib by hand for a certain app and want to have it left that way...
3) If you system is in place, 2) might not be possible at all if not by duplicating and renaming the lib
So, I'd rather be free to be able to do 2) than save a few clicks for copying 2 or 3 files. :)
I mean how you want to tell the compiler which of the sources need to be inside the build of your project!
Sorry but I really wonder if you have read what I explained before...
Nobody can say which Lua files are being loaded at runtime by a program... and the compiler and packager need to know which files your application is going to use.
That is the reason why all files in the project folder are included always. Even if you do not "require" them inside of you program.
One would need to include ALL of the files in those special shared folder and all of the projects subfolders into every project or have the user manually specify which files are to be included before packaging.
As it currently is you know what files are there... and if you name them appropriately you also can group them visually ... where is the need for subfolders anyway?
I see what you mean, but that's different from your initial post.
Citation:
What I was asking for was a standard library folder to store the Corona supplied library files that would be searched if there any unresolved files specified in the "require" statement. For me it would be nice if I didn't have to have a copy of all Corona library files in my project folder.
Which is useless, IMHO.
@erpy
You don't mean me don't you? :)
I did never request any of this.. I jumped in and explained why it does not work and offered the solution with softlinks for those which want to keep files the same between different projects.
I also explained that I won't need any folders on disk for source-code arrangement because I can use groups in the ide for this.
I posted all of this in my initial and my second post... later I got the impression people did not read what I wrote.. or my english is just to bad to understand as I am german... well
In fact, is it possible to manage different files in folders ?
For example, I'd like to put my interface buttons in a folder, my backgrounds in another... and load them with display.newImage(my/path/to/the/folder). Is it possible ?
Thanks in advance
Nope it is not... at least not currently. Because they will not be included in the build.
woah. I'm shocked at this. I actually submitted a bug report WRT not being able to include folders in project builds.
Funny thing is that when running the simulator, moving things into folders works. it's when you build for devices that it all goes wrong.
In fact, is it possible to manage different files in folders ?
You can do this for all files other than code files. Any .lua must be in the project root, but all graphics and sounds can go in sub-folders. That's how I have my project organized: all code in the root, "graphics" folder with all images, "audio" folder with all sound files.
@achesser: Both device and simulator support sub-folders so that is not your issue. Note that the device is case-sensitive for filenames while the simulator is not, so that is probably your problem. Since you seem to think folders work in simulator and not on device, it's probably your directory names that have capitalization mistakes.