Fix the /sdcard/

295 views
Skip to first unread message

Delve Delos Santos Jr

unread,
Jul 24, 2022, 6:35:27 AM7/24/22
to DroidScript
Latest version (2022) of DroidScript is very disappointing when using File System.
Before, /sdcard/ is converted to /storage/emulated/0 (external storage),
but today, /sdcard/ is converted to /storage/emulated/0/Android/data/<package>/files (android data).

Created files and folder is being deleted whenever the application is uninstalled.
Even DroidScript projects are being deleted whenever I uninstall them.

Please fix the /sdcard/.
The folder DroidScript in my external storage is now useless since there is a new path.

Alan Hendry

unread,
Jul 24, 2022, 11:31:12 AM7/24/22
to DroidScript
HI,
Android 10+ brought in Scoped Storage (with the stated aim of cleaning up all an apps files if it is uninstalled)
which restricts the folders apps can read from/write to.
DS then puts your apps/projects in Internal>Android>data>com.smartphoneremote.androidscript>files>DroidScript.
I've found a few paths work consistently (different Android versions, running under DS and as a built/installed APK.AAB)
app.GetPrivateFolder("name")+"/folder/file.extension" // user can't see files
app.GetSpecialFolder("type")+"/folder/file.extension" // user can see file in folder under Internal
type should be "DCIM" or "Pictures" for images, "Movies" for video, "Music" for sound, "Downloads" for other 
Regards, ah

ro...@anderle.sk

unread,
Mar 21, 2024, 1:55:49 AM3/21/24
to DroidScript
in version 2.68  "app.GetSpecialFolder" not working. app.ReadFile from this folder get error and app.WriteFile to this folder write 'I dont know where' 
app.WriteFile( "/storage/emulated/0/Documents/books.txt","sometext")   detto nothing. I am Premium.

Can you help?
.
Thanks
R.

Dátum: nedeľa 24. júla 2022, čas: 17:31:12 UTC+2, odosielateľ: hendr...@gmail.com

ro...@anderle.sk

unread,
Mar 21, 2024, 1:56:44 AM3/21/24
to DroidScript
Android 13

Dátum: štvrtok 21. marca 2024, čas: 6:55:49 UTC+1, odosielateľ: ro...@anderle.sk

Alan Hendry

unread,
Mar 23, 2024, 6:56:42 AM3/23/24
to DroidScript
HI,

If you're writing text I'd try something like
fn = app.GetSpecialFolder("downloads")+"/books.txt"
app.WriteFile(fn,"Lord of the Rings")
the file should be in internal > download

With scoped storage you may need to use CheckPermission/GetPermission
Theres an example called SAF
Regards, ah
Reply all
Reply to author
Forward
0 new messages