Finding images in other base Directories

I’m grabbing an image from the device camera. I know it works because pathForFile returns a result. But display.newImage() can’t find it. I must be missing something obvious about how the simulator works here…

[code]-- Generating the image
media.show( media.Camera, onCameraComplete, { baseDir=system.TemporaryDirectory, filename=“CameraShot.jpg”, type=“image”} )

– Verifying the image is there
local path = system.pathForFile(“CameraShot.jpg”, system.TemporaryDirectory) – returns the full path

– Using the image
local myImage = display.newImage(“CameraShot.jpg”, system.TemporaryDirectory) – comes up nil[/code]

Any ideas? This is my first foray into the using the media library. [import]uid: 41884 topic_id: 34033 reply_id: 334033[/import]

Actually I don’t think the system.pathForFile() will verify the file exists with the exception of things in system.ResourcesDirectory. You would need to do a

file = io.open( path, "r" )  
if file then  
 print("file exists")  
 io.close(file)  
else  
 print("file doesn't exist")  
end  

to actually check for the file’s existence.

I’m not sure why its not displaying. [import]uid: 199310 topic_id: 34033 reply_id: 135330[/import]

Ah, I thought pathForFile would return false if it wasn’t there…

The really curious part of this is that if I add some code after, the image shows, but it still asserts on the new code (which is trying to set the .x position of the image.) [import]uid: 41884 topic_id: 34033 reply_id: 135332[/import]

Actually I don’t think the system.pathForFile() will verify the file exists with the exception of things in system.ResourcesDirectory. You would need to do a

file = io.open( path, "r" )  
if file then  
 print("file exists")  
 io.close(file)  
else  
 print("file doesn't exist")  
end  

to actually check for the file’s existence.

I’m not sure why its not displaying. [import]uid: 199310 topic_id: 34033 reply_id: 135330[/import]

Ah, I thought pathForFile would return false if it wasn’t there…

The really curious part of this is that if I add some code after, the image shows, but it still asserts on the new code (which is trying to set the .x position of the image.) [import]uid: 41884 topic_id: 34033 reply_id: 135332[/import]