[resolved] File write issues

Hello, I am experiencing an annoying error working with Json.

As stated here: http://developer.coronalabs.com/reference/index/filewrite

“Note: For security reasons you are not allowed to write files in the system.ResourceDirectory (the directory where the application is stored). You must specify the system.DocumentsDirectory or system.TemporaryDirectory parameter in system.pathForFile function when opening the file for writing. See io.open.”

I cant save in my ResourceDirectory.

This is a problem because when I build for my Iphone 4 my DocumentsDirectory is empty:

Jan 17 08:56:07 *Secret*[958] : Found file: .
Jan 17 08:56:07 Secret[958] : Found file: …

This is the only thing I find using this code to print whats in the folder:

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 )
end

It works perfectly in the simulator and I can find files in my ResourceDirectory, so basicly I can load stuff but not save. I have tried to put alot of random files in my DocumentsDirectory to make it maybe find something, but on my device I find nothing…

Is there a workaround the file:write in ResourceDirectory restriction or any other solution? Is there any known bugs with DocumentsDirectory on Iphone 4? Any buildsettings I might have missed? [import]uid: 199162 topic_id: 35034 reply_id: 335034[/import]

I think I solved this, had a brain fart not realizing I had to create the file first time on device… [import]uid: 199162 topic_id: 35034 reply_id: 139300[/import]

I think I solved this, had a brain fart not realizing I had to create the file first time on device… [import]uid: 199162 topic_id: 35034 reply_id: 139300[/import]