issue with loading files from system.DocumentsDirectory and system.TemporaryDirectory

Hi 
i am downloading .png files from server and it is working fine but when once file is downloaded and the next time i open game and file is already in system.DocumentDirectory but when i tried to show .png file through display.newImage it does not work and also it doest not give me any error. So i tried to confirm that is the image really exists on that path or not and image is exists on that path but not showing through display.newImage. It happens only in html5 case. 

Does anyone have solution?

Thanks

We working on the fixing this issue.

@mirzafahad12 maybe you can provide a simple testcase which demonstrates the issue ?

thanks

Hi 
Thanks for your quick response.

here is the demo code in which i am downloading image from server. First time when project run it download the image from server and works fine. But second time when it runs file is already exists but not loading through display.newImage.

local function filePathExists(filePath) local exists = false if (filePath) then -- file may exist. won't know until you open it local fileHandle = io.open( filePath, "rb" ) if (fileHandle) then -- nil if no file found exists = true io.close(fileHandle) fileHandle=nil end end return(exists) end local function fileExists(fileName, base) assert(fileName, "fileName is missing") local base = base return filePathExists( system.pathForFile( fileName, base ) ) end local myText = display.newText( "fileExists : ", display.contentWidth\*.5, 400, native.systemFont, 16 ) myText:setFillColor( 1, 0, 0 ) local function downloadFile() local function onDownload(event) if "ended"==event.phase and not event.isError then myText.text = "fileDownloaded : true" local sampleImage = display.newImage("demoImage.png", system.DocumentsDirectory) sampleImage.x = display.contentWidth\*.5 sampleImage.y = display.contentHeight\*.5 elseif "ended"==event.phase and event.isError then myText.text = "fileDownloaded : false" end end local params = {} params.progress = true network.download( "http://placehold.it/120x120&text=image1", "GET", onDownload, params, "demoImage.png", system.DocumentsDirectory ) end if fileExists("demoImage.png", system.DocumentsDirectory) then myText.text = "fileExists : true" local sampleImage = display.newImage("demoImage.png", system.DocumentsDirectory) sampleImage.x = display.contentWidth\*.5 sampleImage.y = display.contentHeight\*.5 else myText.text = "fileExists : false" downloadFile() end  

have a look on code.

Note : project works fine on mobile devices but issue is only with html5 case.

Thanks
 

Thanks for the testcase. The fix will come with next daily build.

Thanks we can wait until the next build.

I have found the same issue is with .mp3 files.
Files are downloading correctly in document directory but not loading through audio.loadSound() or audio.loadStream().

Can you please investigate that issue also.

Thanks

We working on the fixing this issue.

@mirzafahad12 maybe you can provide a simple testcase which demonstrates the issue ?

thanks

Hi 
Thanks for your quick response.

here is the demo code in which i am downloading image from server. First time when project run it download the image from server and works fine. But second time when it runs file is already exists but not loading through display.newImage.

local function filePathExists(filePath) local exists = false if (filePath) then -- file may exist. won't know until you open it local fileHandle = io.open( filePath, "rb" ) if (fileHandle) then -- nil if no file found exists = true io.close(fileHandle) fileHandle=nil end end return(exists) end local function fileExists(fileName, base) assert(fileName, "fileName is missing") local base = base return filePathExists( system.pathForFile( fileName, base ) ) end local myText = display.newText( "fileExists : ", display.contentWidth\*.5, 400, native.systemFont, 16 ) myText:setFillColor( 1, 0, 0 ) local function downloadFile() local function onDownload(event) if "ended"==event.phase and not event.isError then myText.text = "fileDownloaded : true" local sampleImage = display.newImage("demoImage.png", system.DocumentsDirectory) sampleImage.x = display.contentWidth\*.5 sampleImage.y = display.contentHeight\*.5 elseif "ended"==event.phase and event.isError then myText.text = "fileDownloaded : false" end end local params = {} params.progress = true network.download( "http://placehold.it/120x120&text=image1", "GET", onDownload, params, "demoImage.png", system.DocumentsDirectory ) end if fileExists("demoImage.png", system.DocumentsDirectory) then myText.text = "fileExists : true" local sampleImage = display.newImage("demoImage.png", system.DocumentsDirectory) sampleImage.x = display.contentWidth\*.5 sampleImage.y = display.contentHeight\*.5 else myText.text = "fileExists : false" downloadFile() end  

have a look on code.

Note : project works fine on mobile devices but issue is only with html5 case.

Thanks
 

Thanks for the testcase. The fix will come with next daily build.

Thanks we can wait until the next build.

I have found the same issue is with .mp3 files.
Files are downloading correctly in document directory but not loading through audio.loadSound() or audio.loadStream().

Can you please investigate that issue also.

Thanks