Does WriteFile Append work properly? Text is appended in the phone, but a copy to PC excludes the appended text.

272 views
Skip to first unread message

davefinney

unread,
Jul 21, 2020, 5:14:23 PM7/21/20
to DroidScript
I have:

app.WriteFile( Path, Text, "Append" );

Looking at the file on the phone, the appended text is there but, after transferring the file to the PC, only the original Write text is there!

Tried copying the file to another folder in the phone, same again.


Is that a DS bug, or a phone bug?

Thanks, Dave.

Symbroson

unread,
Jul 21, 2020, 5:23:28 PM7/21/20
to DroidScript
If the file was saved properly as you said the issue must lay somewhere in the transferring process

please explain how you transferred the file. web ide / adb / local file server / ...

davefinney

unread,
Jul 21, 2020, 5:51:12 PM7/21/20
to DroidScript
The file does seem to save properly on the phone.

Moved file by:
Plugged phone into PC, opened file manager on PC and copy/pasted into PC file manager.

Symbroson

unread,
Jul 21, 2020, 5:58:45 PM7/21/20
to DroidScript
 I had issues with file transfers from phone to PC over USB in the past myself, mostly missing newly created files. Dunno how the protocol used for that works but there might be issues if you change something in the filesystem after already being connected to your PC.

Try un- and replugging the USB cable. If that doesnt work use one of the other methods I described.

I personally use a local file server in most cases with the root directory being the server home dir. There should be an example of that in the samples section

davefinney

unread,
Jul 21, 2020, 7:12:45 PM7/21/20
to DroidScript
Yes, tried replugging USB, moving files by copying and also by cutting.

The only solution so far is to copy the text manually, create a new empty file, and then paste into new file.

I suspect that, after appending, a full read and then write would fix it. I'll try that.

The append certainly produces a result different to just Writing.

Symbroson

unread,
Jul 21, 2020, 9:10:46 PM7/21/20
to DroidScript
the append method does not do something different than write except moving the writing pointer to the end of the file before writing.
As long as you can confirm the file was correctly saved on the device (that is, if a read method returns the correctly modified results) the file has been saved on the filesystem correctly and the issue is somewhere else, most probably the transferring method

davefinney

unread,
Jul 22, 2020, 8:25:12 AM7/22/20
to DroidScript
Thanks Symbroson,
Yes, files written by an app and seen on the phone often don't appear on the PC in file manager via USB.
I fix this by moving the file on the phones file manager, and it then appears on the PC.
This append issue seems to be the same.
Cheers!
Reply all
Reply to author
Forward
0 new messages