How to Specify system.DocumentsDirectory

How to Specify system.DocumentsDirectory or created system.DocumentsDirectory folder,plz?

When I saved system.ResourceDirectory will jump main.lua? 

what can I do plz help me , thanks

my code

[lua]

function saveValue(strFilename, strValue)-- Save specified value to specified encrypted file

 local theFile = strFilename

 local theValue = strValue

 local path = system.pathForFile( theFile, system.ResourceDirectory  ) --or system.DocumentsDirectory 

 local file = io.open( path, “w” )

 if file then – If the file exists, then continue. Another way to read this line is ‘if file == true then’.

file:write(theValue) – This line will write the contents of the table to the .json file.

io.close(file) – After we are done with the file, we close the file.

return true – If everything was successful, then return true

 end

end

function loadValue(strFilename)-- Load specified encrypted file, or create new file if it does not exist

 local theFile = strFilename

 local path = system.pathForFile( theFile, system.ResourceDirectory  ) --or system.DocumentsDirectory 

 local file = io.open( path, “r” )

 if file then – If file exists, continue. Another way to read this line is ‘if file == true then’.

local contents = file:read( “*a” ) – read all contents of file into a string

io.close( file ) – Since we are done with the file, close it.

return contents – Return the table with the JSON contents

 else

return ‘’ – Return nothing

 end

end

saveM = json.decode(loadValue(‘saveM.txt’))

print(saveM.m1[MtleftNumber1])

if saveM.m1[MtleftNumber1] == MtleftNumber1 and saveM.m1[MtleftNumber1] ~= "Y"then

saveM.m1[MtleftNumber1] = “Y”

else

saveM.m1[MtleftNumber1] = MtleftNumber1

end

– saveM data

saveValue(‘saveM.txt’, json.encode(saveM))

[/lua]

You can do a lot to help us help you.  First please format  your code.  You can use the <> symbol in the edit bar above, or  your can type in (without the space) and paste in your code, then close it with (again without the space).

I’m also not sure what you’re actually asking.

Rob

You can do a lot to help us help you.  First please format  your code.  You can use the <> symbol in the edit bar above, or  your can type in (without the space) and paste in your code, then close it with (again without the space).

I’m also not sure what you’re actually asking.

Rob