Can't require file from sub-folder?

I have an app that runs perfectly using corona sdk but when I try to run in using corona cards I get errors

07-22 00:58:43.584: I/Corona(12194): module 'scripts.scenes.machineScene' not found: 07-22 00:58:43.584: I/Corona(12194): no field package.preload['scripts.scenes.machineScene'] 07-22 00:58:43.584: I/Corona(12194): no file '(null)/scripts.scenes.machineScene.lua' 07-22 00:58:43.584: I/Corona(12194): no file '(null)/scripts.scenes.machineScene.lua' 07-22 00:58:43.584: I/Corona(12194): no file '/data/app-lib/com.example.coronacardeclipse-45/libscripts.scenes.machineScene.so' 07-22 00:58:43.584: I/Corona(12194): no file './scripts.scenes.machineScene.so' 07-22 00:58:43.584: I/Corona(12194): no file '(null)/scripts.scenes.machineScene.so' 07-22 00:58:43.584: I/Corona(12194): no file '/data/app-lib/com.example.coronacardeclipse-45/libscripts.so' 07-22 00:58:43.584: I/Corona(12194): no file './scripts.so' 07-22 00:58:43.584: I/Corona(12194): no file '(null)/scripts.so'

All of these files exist and like I said works fine when I build it using the simulator. I take the files out of the sub-folders and place them in the main directory and it works fine. Can you not have files in sub-folders using coronacards?

Hi,

How are you calling require?

Like this

machineScene = require("scripts.scenes.machineScene")

It actually seems to be having issues using storyboard.gotoScene with files not in the root directory as well. so if I was trying to do this it seems to work just fine

storyboard.gotoScene("someScene);

But doing this throws an error

storyboard.gotoScene("scripts.scenes.someScene);

If you replace the periods with slashes does it work?

Nope, it complains about needing periods instead of slashes 

Any help, this is driving me crazy

Can you give us more detail as to what its saying?

Sure thing… when I replace everything in my main.lua with just this

 

local storyboard = require("storyboard"); storyboard.gotoScene("scripts.scenes.machineScene");

I get this error  t689naj.png

As you can see it’s saying that the file cannot be found. 

Now if I drop that file in the root directory of my corona app and call this
 

local storyboard = require("storyboard"); storyboard.gotoScene("machineScene");

You can see that I no longer get an error saying machineScene doesn’t exist I do get new errors because inside machineScene I’m trying to require files that are in sub-folders and it’s the same issue all over again
fOlFOLe.png

It seems as though anything outside the root folder can’t be required or called because it says it doesn’t exist. 

We’re going to test this out on our end this week and then get back to you.

I’ve verified this bug but it will have to be fixed after the public release.  I don’t know if this will help your use case but if you name your file with the directory structure in the root folder then they’ll still be found.  For example if you have a lua file in something/else/file.lua and you put it in the root directory and name it as something.else.file.lua then it will be found.  This way you won’t have to change your code but you will have to move the files still.

Hi,

How are you calling require?

Like this

machineScene = require("scripts.scenes.machineScene")

It actually seems to be having issues using storyboard.gotoScene with files not in the root directory as well. so if I was trying to do this it seems to work just fine

storyboard.gotoScene("someScene);

But doing this throws an error

storyboard.gotoScene("scripts.scenes.someScene);

If you replace the periods with slashes does it work?

Nope, it complains about needing periods instead of slashes 

Any help, this is driving me crazy

Can you give us more detail as to what its saying?

Sure thing… when I replace everything in my main.lua with just this

 

local storyboard = require("storyboard"); storyboard.gotoScene("scripts.scenes.machineScene");

I get this error  t689naj.png

As you can see it’s saying that the file cannot be found. 

Now if I drop that file in the root directory of my corona app and call this
 

local storyboard = require("storyboard"); storyboard.gotoScene("machineScene");

You can see that I no longer get an error saying machineScene doesn’t exist I do get new errors because inside machineScene I’m trying to require files that are in sub-folders and it’s the same issue all over again
fOlFOLe.png

It seems as though anything outside the root folder can’t be required or called because it says it doesn’t exist. 

We’re going to test this out on our end this week and then get back to you.

I’ve verified this bug but it will have to be fixed after the public release.  I don’t know if this will help your use case but if you name your file with the directory structure in the root folder then they’ll still be found.  For example if you have a lua file in something/else/file.lua and you put it in the root directory and name it as something.else.file.lua then it will be found.  This way you won’t have to change your code but you will have to move the files still.

Hi,
I am evaluating CCards and I am getting exactly the same problem. Do you plan to release the update any time soon?