helloSystem / Filer

A file manager that can also render the desktop
GNU General Public License v2.0
33 stars 8 forks source link

Support custom volume icons #126

Closed probonopd closed 3 years ago

probonopd commented 3 years ago

If .VolumeIcon.icns exists, use it as the icon for the volume.

probonopd commented 3 years ago

This would be incredibly easy to implement if we had items on the desktop that easily gave away the path that gets opened when the item is double clicked.

    QFile dirIconFile(path.toUtf8() + "/.VolumeIcon.icns");
    if (QFile::exists((QFileInfo(dirIconFile).canonicalFilePath()))) {
        icon = QIcon(QFileInfo(dirIconFile).canonicalFilePath());
    }

But we have inherited from libfm this atrocity of computer:///<...>.mount "pseudo files". Do we really have to go through an ordeal similar to

https://github.com/helloSystem/Filer/blob/d72cbffc65b3bc57205a225277f45ff173636628/src/utilities.cpp#L172-L196

just to find out the mountpoint that this computer:///<...>.mount "pseudo files" thing is meant to point to?

probonopd commented 3 years ago

To add insult to the injury, I think mount -p is buggy:

FreeBSD% mount
/dev/da0 on /media/CCRA_X64FRE_DE-DE_DV5 (udf, local, read-only)

FreeBSD% mount -p
/dev/da0                /media/CCRA_X64FRE_DE-DE_DV5 udf        ro              0 0

FreeBSD% mount -p | sed -e 's|\t|\||g'
/dev/da0||/media/CCRA_X64FRE_DE-DE_DV5 udf|ro||0 0

FreeBSD% mount -p | grep /media/CCRA_X64FRE_DE-DE_DV5 | xxd
00000000: 2f64 6576 2f64 6130 0909 2f6d 6564 6961  /dev/da0../media
00000010: 2f43 4352 415f 5836 3446 5245 5f44 452d  /CCRA_X64FRE_DE-
00000020: 4445 5f44 5635 2075 6466 0972 6f09 0930  DE_DV5 udf.ro..0
00000030: 2030 0a                                   0.

Note that there is no tab in front of udf but a space. Wtf, FreeBSD bug in mount?

probonopd commented 3 years ago

Let's QStorageInfo then instead of parsing mount -p. It was horrible anyway.