android external SD save/delete problem

Report any Hollywood bugs here
xabierpayet
Posts: 181
Joined: Fri Feb 24, 2012 9:34 am

android external SD save/delete problem

Post by xabierpayet » Sun Aug 14, 2016 1:03 am

i found a bug (or not) in the android version of hollywood, if i attempt to save any file to the external SD in my phone
i have this error message:

Hollywood player
cannot write to file/storage/extsdcard/multijocs/a.cfg
file:p_loadsave.hws (current line: 127 in function openfile)

* deleting files i have the same problem
* loading files from the SD is working fine


if i try the same example in a sony xperia z phone or in a samsung galaxy tab 2, the example work fine, but in the galaxy grand prime or in the xperia t this is not working, do you know how to solve this? i need to write in the external SD

User avatar
airsoftsoftwair
Posts: 3068
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: android external SD save/delete problem

Post by airsoftsoftwair » Sun Aug 14, 2016 9:02 pm

Small code snippet please :)

xabierpayet
Posts: 181
Joined: Fri Feb 24, 2012 9:34 am

Re: android external SD save/delete problem

Post by xabierpayet » Mon Aug 15, 2016 1:59 am

the snippet, under all the plattforms is working fine, in android too, but i don´t know why in some android versions don´t let write to the SD card, but i can create files, delete or rename with all the android apps in the market on them

path$ = PathRequest("Select a path")
save$="123.txt"
savestr$="456"
save$=path$.."/"..save$
openfile(1,save$,#mode_write)
writeline(1,savestr$)
closefile(1)

User avatar
airsoftsoftwair
Posts: 3068
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: android external SD save/delete problem

Post by airsoftsoftwair » Mon Aug 15, 2016 11:32 am

What happens if you try to write to GetSystemInfo().ExternalStorage? e.g.

Code: Select all

a$ = FullPath(GetSystemInfo().ExternalStorage, "test.txt")
OpenFile(1,a$,#MODE_WRITE)
WriteLine(1,"Test")
CloseFile(1)
Does it work?

xabierpayet
Posts: 181
Joined: Fri Feb 24, 2012 9:34 am

Re: android external SD save/delete problem

Post by xabierpayet » Mon Aug 15, 2016 11:33 pm

doesn´t work, i dont have error message, but the file was not created

xabierpayet
Posts: 181
Joined: Fri Feb 24, 2012 9:34 am

Re: android external SD save/delete problem

Post by xabierpayet » Tue Aug 16, 2016 12:21 am

i try it with:

a$ = FullPath(GetSystemInfo().SDCard, "test.txt")

too with not luck

xabierpayet
Posts: 181
Joined: Fri Feb 24, 2012 9:34 am

Re: android external SD save/delete problem

Post by xabierpayet » Tue Aug 16, 2016 1:04 am

here you have 2 screenshots of my storage and emulated folders:
Image
Image
and other of :
a$ = FullPath(GetSystemInfo().... different combinations
Image

User avatar
airsoftsoftwair
Posts: 3068
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: android external SD save/delete problem

Post by airsoftsoftwair » Tue Aug 16, 2016 6:37 pm

It works here on all my devices. What Android version is running on the devices where it doesn't work?

Do you get an error message when running this code or is the file just not created? I didn't really understand this from your previous comments.

Code: Select all

a$ = FullPath(GetSystemInfo().ExternalStorage, "test.txt")
OpenFile(1,a$,#MODE_WRITE)
WriteLine(1,"Test")
CloseFile(1)

xabierpayet
Posts: 181
Joined: Fri Feb 24, 2012 9:34 am

Re: android external SD save/delete problem

Post by xabierpayet » Tue Aug 16, 2016 9:11 pm

Using normal save instruction:
work in 4.4.4 samsung galaxy tab 2
No work in samsung galaxy grand prime 5.1.1
here...

using:

a$ = FullPath(GetSystemInfo().SDCard, "test.txt")
b$=GetSystemInfo().SDCard
OpenFile(1,a$,#MODE_WRITE)
WriteLine(1,"Test")
CloseFile(1)
debugprint(b$)
files = FileRequest("Search file", "*",#REQ_MULTISELECT,b$)

i see some things, the file is saved but in the internal memory, and the debug output say:
/storage/emulated/0

if i change sdcard for externalstorage, the file is saved in other place, but not in the sd card, this happen in the 2 devices

a$ = FullPath(GetSystemInfo().ExternalStorage, "test.txt")
b$=GetSystemInfo().SDCard
OpenFile(1,a$,#MODE_WRITE)
WriteLine(1,"Test")
CloseFile(1)
debugprint(b$)
files = FileRequest("Search file", "*",#REQ_MULTISELECT,b$)

and the debug output say:
/storage/emulated/0/Android/data/com.lotofxxxxx.xxx/files

both situations work in the devices in the same way, exactly, i don´t have error why the file really is saved, but not in the root of the SD card, or in an custom drawer

User avatar
airsoftsoftwair
Posts: 3068
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: android external SD save/delete problem

Post by airsoftsoftwair » Wed Aug 17, 2016 11:52 am

Ok, now I see what you mean. There's nothing wrong with Hollywood here. Hollywood just uses the paths that Android reports. However, external storage and SDCard don't necessarily mean external storage and SDCard :) As usual with Android, it's all up to the decision of the device manufacturer what these paths actually point to. That's why it works on one device and doesn't work on the other. See here for a more detailed explanation:
http://stackoverflow.com/questions/5694 ... d-location

Post Reply