incognitum
Posts: 464
Joined: Tue Oct 30, 2018 3:34 pm

Re: Etcher for Raspberry Pi

Thu Mar 05, 2020 6:56 pm

bzt wrote:
Thu Mar 05, 2020 6:19 pm
incognitum wrote:Sounds like a bug.
I haven't checked the whole source, but I suspect maybe this line has something to do with it?
Nope.
If you do for testing purposes:

Code: Select all

    QUrl u("file:///accénts-and-中文.img");
    qDebug() << u.toString(u.FullyEncoded).toLatin1();
You will see it prints out:

Code: Select all

"file:///acc%C3%A9nts-and-%E4%B8%AD%E6%96%87.img"
Which is correct.

The toString(QUrl::FullyEncoded) call is what does the conversion of the unicode characters to %codes.
The toLatin1() is just because we want to have the result stored in a "normal" (8-bit) character array, instead of a 16-bit one of which only 8-bit is used.
incognitum wrote:Will only cache the file if there is >5 GB available disk space.
Good that you have thought of that! The problem with this is however that most Linux distributions report out of disk space error for non-root users when free space goes below 5% (which can be greater than 5GB).
Think the Qt call used already takes that into account.

https://doc.qt.io/qt-5/qstorageinfo.html#bytesAvailable

Note that the software normally runs as regular user under Linux. (It asks udisks2 to do privileged operations like opening the disk device, and passing through the file descriptor through DBus.)
So bytesAvailable() should already return bytesFree() minus 5%.
At least that is how I understand the Qt functions.

bzt
Posts: 542
Joined: Sat Oct 14, 2017 9:57 pm

Re: Etcher for Raspberry Pi

Thu Mar 05, 2020 7:19 pm

incognitum wrote:
Thu Mar 05, 2020 6:56 pm
The toString(QUrl::FullyEncoded) call is what does the conversion of the unicode characters to %codes.
I don't know then. I've noticed áéíóö works, only őű in path are problematic. This could be very well caused by the Qt lib I've installed, and probably non Raspberry Pi Imager related.
incognitum wrote:
Thu Mar 05, 2020 6:56 pm
So bytesAvailable() should already return bytesFree() minus 5%.
At least that is how I understand the Qt functions.
Then this is perfect!

Cheers,
bzt

Return to “General discussion”