Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inter-operate with platform-specific "favorite directories" #1238

Open
charlesdaniels opened this issue Aug 7, 2020 · 18 comments
Open

Inter-operate with platform-specific "favorite directories" #1238

charlesdaniels opened this issue Aug 7, 2020 · 18 comments
Labels
enhancement New feature or request FileDialog Improvements to the builtin file dialogs Hacktoberfest

Comments

@charlesdaniels
Copy link
Member

We should consider adding some kind of capability, possible as part of the driver, that exposes the platform's "favorite directories". For a start, we could just read them and add to the side-bar, but in a perfect world we would interact with these bi-bidirectionally.

windows_favorites

macos_favorites

@andydotxyz andydotxyz added the enhancement New feature or request label Aug 7, 2020
@noerw
Copy link

noerw commented Aug 8, 2020

These files contain the bookmarks on different systems:

environment file format
Linux Gnome (nautlius) ~/.config/gtk-3.0/bookmarks line separated file:// or dav:// URIs
Linux KDE (dolphin) ~/.local/share/apps/kfileplaces/bookmarks.xml unknown xml?
Windows 10 %userprofile%\AppData\Roaming\Microsoft\Windows\Recent\CustomDestinations ?
OSX ~/Library/Preferences/com.apple.sidebarlists.plist .plist file
android ? ?
iOS ? ?

@andydotxyz
Copy link
Member

This is going to be a lot of work especially as we consider all the different linux desktops and distributions.

@charlesdaniels
Copy link
Member Author

My $0.02 -- we should build a library that solves this on it's own, and then use it as an internal dependency of Fyne. People building other programs could well want that as an independent thing from Fyne also.

@noerw
Copy link

noerw commented Oct 24, 2020

In the meantime i found this; which basically implements what @charlesdaniels described, though it might need some platform specific adjustments, as windows afaik does not follow XDG ;)
https://github.com/adrg/xdg

@andydotxyz
Copy link
Member

As far as I know XDG is only followed on Linux. None of Windows, macOS, iOS or Android use this spec.

Also, as you noted before, the user-configured list of directories (which this ticket aims to match) is not part of the XDG but instead specific to the desktop shell that the user prefers.
With regards to which location should be used for each XDG known location we have added support for that in 1.4 already, having been tracked in #1248.

@AlbinoGeek
Copy link
Contributor

Linux global: FreeDesktop Bookmark Specification

I can also put together a list of known XDG formats for this if it will help this along, having implemented favourites in my app already.

@Lewiscowles1986
Copy link

The files in the CustomDestinations folder on windows follow the Structured Storage format by Microsoft; it reads (from their docs) like someone on a night out designed the format while unable to function.

@Lewiscowles1986
Copy link

Lewiscowles1986 commented Dec 11, 2021

Going to see if I can use some off the shelf reference code to read (C#) https://github.com/ironfede/openmcdf

If I can find a way to read in this and the C/CPP microsoft examples; it might become more obvious what they are doing and why. Frustratingly guidance on This stackoverflow on the files suggests the format has changed;

Update None of these files were structured storage format that I attempted to open.

@Lewiscowles1986
Copy link

Interestingly I can enumerate all the values in powershell using the following

$QuickAccess = New-Object -ComObject shell.application
$QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}").Items()

I need to find out where the heck {679f85cb-0220-4080-b29b-5540cc05aab6} exists as regedit cannot find it; and neither can find.

@AlbinoGeek
Copy link
Contributor

AlbinoGeek commented Dec 11, 2021 via email

@Lewiscowles1986
Copy link

Do you mean sub-process, and then interpret the output?

@AlbinoGeek
Copy link
Contributor

AlbinoGeek commented Dec 11, 2021 via email

@AlbinoGeek
Copy link
Contributor

AlbinoGeek commented Dec 11, 2021 via email

@Lewiscowles1986
Copy link

If you would like to chase that path, feel free. I'm trying to extract the win32 API calls. It'll just make me feel better.

@Lewiscowles1986
Copy link

Source file: %userprofile%\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations\f01b4d95cf55d32a.automaticDestinations-ms contained all these entries for me. Curious it should be in a single file (not one other file had any destinations for me).

In case it matters, I'm on Windows 10 64-bit home, Version 10.0.19044 Build 19044

I've still not found a way to ensure this is the right file or get this information in go.

@Lewiscowles1986
Copy link

Interestingly enough this link about backing up those explorer pinned items suggests that the same file as I found my pinned items in, should be backed up. Perhaps there is a standard list, or a canonical path to the file?

@Lewiscowles1986
Copy link

Source file: %userprofile%\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations\f01b4d95cf55d32a.automaticDestinations-ms does read with the Structured Storage eXplorer, which I had to compile from source of the OpenMCDF GitHub project

@Lewiscowles1986
Copy link

Lewiscowles1986 commented Dec 13, 2021

https://github.com/EricZimmerman/OleCf/blob/master/OleCf/Header.cs is about reading this file-type. Which is apparently shared with old pre docx word documents.

https://github.com/richardlehane/mscfb/network is a go reader of the file-type; so something akin to https://github.com/EricZimmerman/JumpList should be used to parse out the locations.

~I Think a benefit of this will also be that for windows, this software currently seems to assume /Documents will exist. I know from experience that I sometimes move this folder, and that Windows supports that; so this work could remove a classification of bug. (I did not fix this in Hack)

Here is a sample repo I made using richardlehane with EricZimmerman C# code as a reference I hacked it together https://github.com/Lewiscowles1986/read-pinned-folders

There seems no ability to rename the folder, so the basename must be what is displayed I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request FileDialog Improvements to the builtin file dialogs Hacktoberfest
Projects
None yet
Development

No branches or pull requests

5 participants