copy code is this code:
function copyFile( srcName, srcPath, dstName, dstPath, overwrite ) local results = false local fileExists = doesFileExist( srcName, srcPath ) if ( fileExists == false ) then return nil -- nil = Source file not found end -- Check to see if destination file already exists if not ( overwrite ) then if ( fileLib.doesFileExist( dstName, dstPath ) ) then return 1 -- 1 = File already exists (don't overwrite) end end -- 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, errorString = io.open( wFilePath, "wb" ) if not ( wfh ) then -- Error occurred; output the cause print( "File error: " .. errorString ) return false else -- Read the file and write to the destination directory local data = rfh:read( "\*a" ) if not ( data ) then print( "Read error!" ) return false else if not ( wfh:write( data ) ) then print( "Write error!" ) return false end end end results = 2 -- 2 = File copied successfully! -- Close file handles rfh:close() wfh:close() return results end -- Copy "readme.txt" from "system.ResourceDirectory" to "system.DocumentsDirectory" copyFile( "readme.txt", nil, "readme.txt", system.DocumentsDirectory, true )
it’s used to copy files. i had mine, but i could not create an android build on mac. from the error it gave:
/Applications/Corona-3124/Corona Simulator.app/Contents/Resources/build.xml:462: The following error occurred while executing this line: /Applications/Corona-3124/Corona Simulator.app/Contents/Resources/build.xml:399: Failed to copy db/vasco\_gama.db to /var/folders/0\_/0jl97qgn5jv0ynncxhmpcwsc0000gp/T/CLtmp0gwsQv/output/assets/db/vasco\_gama.db due to Bad address
i assumed was about my copy file code i had…so i remove it and used corona code, but i still have the same error.
the funny part is that if i build in the same mac with the same code for IOS device. it will work fine. only if i trie to build for android it will give me this error. most likely is a mac simulator problem, (on windows works fine also) but first i need to know if any understand this report.