pathForFile Warnings

Is there a way to get the existence of a file in a folder inside ResourceDirectory so that I can skip all warnings pathForFile causes??
The reason I can’t just use io.open is that the file I’m searching isn’t in the root directory, so I need to get the real path when using the app in the device instead of the simulator.
I’ve though about disabling the output and enabling it after pathForFile (what is a bit tedious as I use Glider and I need to deal with CiderDebugger), but there’s probably a cleaner way.

Thanks [import]uid: 159884 topic_id: 35921 reply_id: 335921[/import]

I think this week’s blog might answer your question.
http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/ [import]uid: 70847 topic_id: 35921 reply_id: 142766[/import]

I didn’t see that FAQ till now but the warnings remain as they still use pathForFile.
Actually in my case is not even needed io.open as pathForFile returns nil if the file isn’t found

Thanks anyway [import]uid: 159884 topic_id: 35921 reply_id: 142769[/import]

There is no way to turn off the warnings if you try to get a path for the ResourceDirectory. The idea behind that is you should know what files you have in the resource directory because they must be present when you build the app. One solution is to create a text file containing the file structure of the resource directory and you read in that file first to determine what’s in the Resource directory. You would then use the file and path that you extract from the text file with system.pathForFile to access the real file. That would eliminate the warning message.

Another way to get only the file path of the ResourceDirectory using system.pathForFile is to use a file that you know is in your resource directory and use the string library to remove the file name, leaving only the path. You need to be careful on Android because of the limitation of not returning certain file extensions (as mentioned in the Wednesday FAQ blog post, http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/) [import]uid: 7559 topic_id: 35921 reply_id: 142811[/import]

Thanks for the reply!! I’ll try both solutions, they are a clever way to skip this annoying warnings [import]uid: 159884 topic_id: 35921 reply_id: 143173[/import]

I think this week’s blog might answer your question.
http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/ [import]uid: 70847 topic_id: 35921 reply_id: 142766[/import]

I didn’t see that FAQ till now but the warnings remain as they still use pathForFile.
Actually in my case is not even needed io.open as pathForFile returns nil if the file isn’t found

Thanks anyway [import]uid: 159884 topic_id: 35921 reply_id: 142769[/import]

There is no way to turn off the warnings if you try to get a path for the ResourceDirectory. The idea behind that is you should know what files you have in the resource directory because they must be present when you build the app. One solution is to create a text file containing the file structure of the resource directory and you read in that file first to determine what’s in the Resource directory. You would then use the file and path that you extract from the text file with system.pathForFile to access the real file. That would eliminate the warning message.

Another way to get only the file path of the ResourceDirectory using system.pathForFile is to use a file that you know is in your resource directory and use the string library to remove the file name, leaving only the path. You need to be careful on Android because of the limitation of not returning certain file extensions (as mentioned in the Wednesday FAQ blog post, http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/) [import]uid: 7559 topic_id: 35921 reply_id: 142811[/import]

Thanks for the reply!! I’ll try both solutions, they are a clever way to skip this annoying warnings [import]uid: 159884 topic_id: 35921 reply_id: 143173[/import]

I think this week’s blog might answer your question.
http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/ [import]uid: 70847 topic_id: 35921 reply_id: 142766[/import]

I didn’t see that FAQ till now but the warnings remain as they still use pathForFile.
Actually in my case is not even needed io.open as pathForFile returns nil if the file isn’t found

Thanks anyway [import]uid: 159884 topic_id: 35921 reply_id: 142769[/import]

There is no way to turn off the warnings if you try to get a path for the ResourceDirectory. The idea behind that is you should know what files you have in the resource directory because they must be present when you build the app. One solution is to create a text file containing the file structure of the resource directory and you read in that file first to determine what’s in the Resource directory. You would then use the file and path that you extract from the text file with system.pathForFile to access the real file. That would eliminate the warning message.

Another way to get only the file path of the ResourceDirectory using system.pathForFile is to use a file that you know is in your resource directory and use the string library to remove the file name, leaving only the path. You need to be careful on Android because of the limitation of not returning certain file extensions (as mentioned in the Wednesday FAQ blog post, http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/) [import]uid: 7559 topic_id: 35921 reply_id: 142811[/import]

Thanks for the reply!! I’ll try both solutions, they are a clever way to skip this annoying warnings [import]uid: 159884 topic_id: 35921 reply_id: 143173[/import]

I think this week’s blog might answer your question.
http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/ [import]uid: 70847 topic_id: 35921 reply_id: 142766[/import]

I didn’t see that FAQ till now but the warnings remain as they still use pathForFile.
Actually in my case is not even needed io.open as pathForFile returns nil if the file isn’t found

Thanks anyway [import]uid: 159884 topic_id: 35921 reply_id: 142769[/import]

There is no way to turn off the warnings if you try to get a path for the ResourceDirectory. The idea behind that is you should know what files you have in the resource directory because they must be present when you build the app. One solution is to create a text file containing the file structure of the resource directory and you read in that file first to determine what’s in the Resource directory. You would then use the file and path that you extract from the text file with system.pathForFile to access the real file. That would eliminate the warning message.

Another way to get only the file path of the ResourceDirectory using system.pathForFile is to use a file that you know is in your resource directory and use the string library to remove the file name, leaving only the path. You need to be careful on Android because of the limitation of not returning certain file extensions (as mentioned in the Wednesday FAQ blog post, http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/) [import]uid: 7559 topic_id: 35921 reply_id: 142811[/import]

Thanks for the reply!! I’ll try both solutions, they are a clever way to skip this annoying warnings [import]uid: 159884 topic_id: 35921 reply_id: 143173[/import]