Issue with slideView [Solved]

I’ve integrated a customized version of slideView in my application.  My slideView.lua takes a table as a list of the images it should display when you call the new function.  Without going into too much detail, my app scans the Documents Directory for images with certain names.  It places these in a table, and then passes this to slideView.new() when I call it.  I’ve printed the table, and all of the file locations are correct.  Even the error shows the correct directory (several other errors follow, all due to this one).  I have the directory scan print all the files and they’re listed as being right there.  I’ve included the related code.  Does anyone smarter than me know why this is happening?  Thanks

---SET UP SLIDE VIEW------------     local slideView = require("slideView")     local myImages = {}     local lfs = require "lfs"     local doc\_path = system.pathForFile( "", system.DocumentsDirectory )     for file in lfs.dir(doc\_path) do         -- file is the current file or directory name         print( "Found file: " .. file )         local temp\_s = tostring ( file )     local valid\_image = string.find( temp\_s, \_current\_category )          local file\_path = system.pathForFile( file, system.DocumentsDirectory )          if valid\_image ~= nil then         table.insert ( myImages, file\_path )     end     end     --Set up image table         \_slides = true         slide\_view = slideView.new( myImages )         screenGroup:insert(slide\_view)  

Here’s the error:

WARNING: Failed to find image(/Users/developer/Library/Application Support/Corona Simulator/13-9FE18D0245AD798036F6011A3800FA11/Documents/Test_1370130505.png)

Runtime error

…hx07fccr724h0000gp/T/TemporaryItems/13/slideView.lua:60: attempt to index local ‘p’ (a nil value)

stack traceback:

…hx07fccr724h0000gp/T/TemporaryItems/13/slideView.lua:60: in function ‘new’

…7fccr724h0000gp/T/TemporaryItems/13/image_viewer.lua:41: in function <…7fccr724h0000gp/T/TemporaryItems/13/image_viewer.lua:16>

?: in function ‘dispatchEvent’

?: in function ‘showOverlay’

…hx07fccr724h0000gp/T/TemporaryItems/13/view_bank.lua:90: in function ‘_onRowTouch’

?: in function ‘touch’

?: in function <?:773>

?: in function <?:218>

Well, FINALLY solved this issue.  Turns out, as I discovered here (http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/), that “you don’t use  system.pathForFile  in API calls that require a  baseDirectory  parameter (e.g., display.newImage, display.newImageRect, audio.loadSound, etc.).”  So, I changed the code to just save the file name, rather than entire path, and then set system.DocumentsDirectory as the baseDirectory for display.newImage in my version of slideView.lua.

The problem is that the compiler puts image files supplied in a different folder than you use when you download them. I hit the same problem in one app I was trying to build. I wanted to be able to replace the images at runtime, assuming they had an internet connection. That would result in the old compiled version of the image being in the app after it had been replaced by a more current one. Another user suggested using aliases in LuaFS to fake the file being in the download folder, when the actual file is in the compiled static folder.  The other issue is the slideview needs to be updated to support getting files from both sources, and you need a way to designate which folder to pull it from. I don’t know how much overhead it adds to search the download folder first, and use that one, and then search the static folder second. 

Most other embedded compilers would let you designate where you want compiled in blobs but not this one.

Well, FINALLY solved this issue.  Turns out, as I discovered here (http://www.coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/), that “you don’t use  system.pathForFile  in API calls that require a  baseDirectory  parameter (e.g., display.newImage, display.newImageRect, audio.loadSound, etc.).”  So, I changed the code to just save the file name, rather than entire path, and then set system.DocumentsDirectory as the baseDirectory for display.newImage in my version of slideView.lua.

The problem is that the compiler puts image files supplied in a different folder than you use when you download them. I hit the same problem in one app I was trying to build. I wanted to be able to replace the images at runtime, assuming they had an internet connection. That would result in the old compiled version of the image being in the app after it had been replaced by a more current one. Another user suggested using aliases in LuaFS to fake the file being in the download folder, when the actual file is in the compiled static folder.  The other issue is the slideview needs to be updated to support getting files from both sources, and you need a way to designate which folder to pull it from. I don’t know how much overhead it adds to search the download folder first, and use that one, and then search the static folder second. 

Most other embedded compilers would let you designate where you want compiled in blobs but not this one.