when i try the under function in win,it worked.But failed when i build for android devices.
function copyFile( srcName, srcPath, dstName, dstPath )
local results = true -- assume no errors
-- Copy the source file to the destination file
--
local rfilePath = system.pathForFile( srcName, srcPath )
local wfilePath = system.pathForFile( dstName, dstPath )
local rfh = io.open( rfilePath, "rb" )
local wfh = io.open( wfilePath, "wb" )
if not wfh then
print( "writeFileName open error!" )
results = false -- error
else
-- Read the file from the Resource directory and write it to the destination directory
local data = rfh:read( "\*a" )
if not data then
print( "read error!" )
results = false -- error
else
if not wfh:write( data ) then
print( "write error!" )
results = false -- error
end
end
end
-- Clean up our file handles
rfh:close()
wfh:close()
return results
end
[import]uid: 45977 topic_id: 21671 reply_id: 321671[/import]