Tabbar button bug using files in the DocumentsDirectory

Hi !

I just experienced an issue with the tabbar widget.

When I create a tab button using these options :

{

  label=“Tab 1”,

  defaultFile=“tab1.png”

  overFile=“tab1_over.png”,

  baseDir=system.DocumentsDirectory,

  width=64,

  height=64,

  onPress=onBtnPress,

  size=12,

  font=native.systemFont,

  selected=true

}

an error occured : “Failed to find image …” but the image “tab1.png” is located in the Documents directory.

I set baseDir=system.DocumentsDirectory but the program stills searches in the Resource Directory.

(I put the image in the Resources directory and it worked). But I need using images in the Documents Directory.

Can you help me please ?

Thanks.

Question is how do you put the images in system.DocumentsDirectory? Anything you place in your project folder on your PC/Mac go into your ResourceDirectory. If you want your app to access things from your DocumentsDirectory then you need to be copying things there from your ResourceDirectory through code. Could this be part of the problem?

In fact the file is already in the Documents directory (downloaded and saved to the documents directory) and I have verified that the file has correctly been copied.

The image is in the correct folder /Users/XXX/Library/Application Support/Corona Simulator/NNNNN/Documents (on a Mac this is the Documents directory of the application). So there is no problem here.

I tested in another way :

  • I put the image directly in the resources folder of the application

  • I removed it from the Documents folder of the application

  • I let the option  baseDir=system.DocumentsDirectory

Result :  this works. Strange, isn’t it ? The file does not exist in the Documents folder anymore but it works (the file is found).

That’s why I think that the tabbar widget source code is ignoring the baseDir option for the tabbar buttons. If it is the case then it is an important issue that needs to be fixed as soon as possible.

To summarize :

  1. The program does not find an image in the Documents directory although it exists

  2. The program finds the image that is in the Resources directory although I specified the Documents directory and the file is not in the Documents directory

My conclusion : the tabbar widget source code is ignoring the baseDir option for the tabbar buttons.

Question is how do you put the images in system.DocumentsDirectory? Anything you place in your project folder on your PC/Mac go into your ResourceDirectory. If you want your app to access things from your DocumentsDirectory then you need to be copying things there from your ResourceDirectory through code. Could this be part of the problem?

In fact the file is already in the Documents directory (downloaded and saved to the documents directory) and I have verified that the file has correctly been copied.

The image is in the correct folder /Users/XXX/Library/Application Support/Corona Simulator/NNNNN/Documents (on a Mac this is the Documents directory of the application). So there is no problem here.

I tested in another way :

  • I put the image directly in the resources folder of the application

  • I removed it from the Documents folder of the application

  • I let the option  baseDir=system.DocumentsDirectory

Result :  this works. Strange, isn’t it ? The file does not exist in the Documents folder anymore but it works (the file is found).

That’s why I think that the tabbar widget source code is ignoring the baseDir option for the tabbar buttons. If it is the case then it is an important issue that needs to be fixed as soon as possible.

To summarize :

  1. The program does not find an image in the Documents directory although it exists

  2. The program finds the image that is in the Resources directory although I specified the Documents directory and the file is not in the Documents directory

My conclusion : the tabbar widget source code is ignoring the baseDir option for the tabbar buttons.