please, help me to identify where the bug is.
instruction:
donwload the attached stack and compile it for Android devices (note: there's a media files folder to be added as non-stack files folder before compiling the app.
run the app on android device (iOS is immune, it seems. there are other weird things, in that environment. see: http://forums.livecode.com/viewtopic.php?f=8&t=27962).
use the 4 buttons (2 "copy OK" + 2 "copy KO")
see the result
what the buttons do:
- get the files in the app embedded folder
- filter the contents to get one single file, based on its extensions
- copy it into the app documents folder
differences between "OK" and "KO" buttons:
- in "OK" btns there's an "answer" to show the list of files
- in "KO" btns the "answer" row is commented out
results:
- the "OK" btns copy the file as expected, even if NOT ALWAYS (see *note)
- the "KO" btns fail // weird…
- in the "OK" btns, anyway, the "answer" shows an empty file list… //weird weird…
tested on samsung tablet running Android 6.0.1
stack made with LC 8.1 build 14005 "Indy", on osx 10.10.5 with Android SDK rev 25.2.2 (the last one as of 20190921)
i'd like to attach also the apk binary, but it 's larger than this forum upload size limit. i can put on public dropBox if needed.
*note: if i run this test on asus tablet running Android 4.2.1 then the procedures fail in all 4 cases. //weird weird weird…
side effect: if you have to build an app which copies files on local drive, then you can't build it with LC8.
personal side effect: i currently have an app in production that needs to be upgraded for iOS 10 compatibility. it has to copy a .sqlite db on local folder. therefore i'm stuck.
additional info: yes, of course the same app built using LC7 works like a charm (see "workaround").
workaround: to get the files list, the use of the good old defaultFolder way ("the files" function) instead of new function "files(<path-to-your-folder>)" is useless. therefore, no workaround found yet.
humble request: may we have LC7 support back? please… please… please… come on… please…

if someone will confirm this is a bug, with some advice about where the bug is (! i think the culprit be the "files()" function, but i can't be sure i'm absolutely right), then i'll be happy (so to speak) to file a new bug on quality.livecode.
regards.
APPENDIX
the full scripts:
OK
Code: Select all
on mouseUp
put "result:" && copyMyFile() into fld "log"
end mouseUp
function copyMyFile
local tMediaFileList,tPathApp,tOrigine,tDestinazione
put specialFolderPath("resources") & SLASH & "mediatest" into tPathApp
answer "files in embedded folder: " && files(tPathApp) //DEBUG
put files(tPathApp) into tMediaFileList
filter tMediaFileList with "*.png"
put tPathApp & SLASH & tMediaFileList into tOrigine
answer "Origin: " && tOrigine //DEBUG
put specialFolderPath("documents") & SLASH & tMediaFileList into tDestinazione
answer "Destination: " && tDestinazione //DEBUG
put URL ("binfile:"& tOrigine) into URL ("binfile:"&tDestinazione)
answer "result: " && tDestinazione //DEBUG
return tMediaFileList
end copyMyFile
Code: Select all
on mouseUp
put "result:" && copyMyFile() into fld "log"
end mouseUp
function copyMyFile
local tMediaFileList,tPathApp,tOrigine,tDestinazione
put specialFolderPath("resources") & SLASH & "mediatest" into tPathApp
//answer "files in embedded folder: " && files(tPathApp) //DEBUG
put files(tPathApp) into tMediaFileList
filter tMediaFileList with "*.png"
put tPathApp & SLASH & tMediaFileList into tOrigine
answer "Origin: " && tOrigine //DEBUG
put specialFolderPath("documents") & SLASH & tMediaFileList into tDestinazione
answer "Destination: " && tDestinazione //DEBUG
put URL ("binfile:"& tOrigine) into URL ("binfile:"&tDestinazione)
answer "result: " && tDestinazione //DEBUG
return tMediaFileList
end copyMyFile