Fix cross-filesystem move, and add custom docset support - #2
Conversation
The use of QFile::move() to move the docset into its final location only works if the temporary directory and the docset directory are on the same filesystem. Rather than recursively copying the docset directory, just use a temporary directory within the docset directory. This should make it nearly certain that they reside on the same filesystem.
Zeal has an extensive library of docsets, but it's possible to manually create docsets too. Allow the user to place docsets into a separate directory (~/.local/share/albert/docs/custom_docsets) with an appropriate icon file. Search this directory for valid docsets and index them just like the ones downloaded from Zeal.
|
@ty brenns. merged manually to make conventional commit messages. im curious though which kind of custom docsets do you use? is there some other source of docsets out there? |
|
@ManuelSchneid3r thank you! I like to have docsets for some python libraries that I use in my daily work, like drgn. There is a project called doc2dash which allows you to convert the sphinx documentation for a Python library into a docset. I don't know if the dash project wants to have very specific libraries like that, and I don't know that it would be worth maintaining officially. So that's why I like being able to build a docset locally and put it into my Albert directory. |
|
This sound actually pretty useful. If you have some spare time, you could put a little tutorial into the readme. Or just post it here and I'll add it |
Hello! This has two changes, which I can split up if you want to review them separately. First is a fix for #1, taking your approach of extracting the docset into the docset directory. Thankfully
QTemporaryDirectoryallows specifying a custom temporary pattern, so we can specify where we want the temporary directory, while still getting the rest of the semantics (auto deletion) for free.The second change is a much nicer way of approaching albertlauncher/plugins#133: "custom docsets". I'd like to be able to browse docsets that aren't part of the Zeal collection. So I add a second directory where you can place any directory named
*.docsetwhich contains an icon. Albert detects these and includes them in the collection of docsets.