Coder Social home page Coder Social logo

Parse ~/.config/user-dirs.dirs file about xdg HOT 6 OPEN

adrg avatar adrg commented on June 9, 2024 2
Parse ~/.config/user-dirs.dirs file

from xdg.

Comments (6)

mateusz834 avatar mateusz834 commented on June 9, 2024

Also it looks like XDG_*_DIR env vars do not override the user-dirs.dirs file, checked in firefox/chromium

const (
	envDesktopDir     = "XDG_DESKTOP_DIR"
	envDownloadDir    = "XDG_DOWNLOAD_DIR"
	envDocumentsDir   = "XDG_DOCUMENTS_DIR"
	envMusicDir       = "XDG_MUSIC_DIR"
	envPicturesDir    = "XDG_PICTURES_DIR"
	envVideosDir      = "XDG_VIDEOS_DIR"
	envTemplatesDir   = "XDG_TEMPLATES_DIR"
	envPublicShareDir = "XDG_PUBLICSHARE_DIR"
)

from xdg.

adrg avatar adrg commented on June 9, 2024

Hi @mateusz834. Thank you for your interest in the library. Reading user-dirs.dirs is already a task in my to-do list.
I'll start working on this. Hopefully, I can release a new version sometime next week (depending on my free time).

Also it looks like XDG_*_DIR env vars do not override the user-dirs.dirs file, checked in firefox/chromium

Yeah, that seems to be the case. I think the priority to should be:
user-dirs.dirs values > environment variables > defaults

from xdg.

mateusz834 avatar mateusz834 commented on June 9, 2024

It even look like that env vars are completely ignored by firefox/chromium.
I removed the user-dirs.dirs file and set the XDG_DOWNLOAD_DIR env var to a different directory and the downloaded file was saved in the default directory.

But for backwards compatibility I think that the order should be:
environment variables > user-dirs.dirs values > defaults

Maybe someone is relying on the env vars now and after the change it will suddenly use values from user-dirs.dirs??

from xdg.

adrg avatar adrg commented on June 9, 2024

Ideally, there would be no breaking changes. I try to steer clear of them as much as possible. However, in this case, I think the default behavior going forward should be to rely on the values provided by user-dirs.dirs, then fall back to other sources.

I made a quick search through GitHub and it seems most people are using this package for base directories rather than user directories. I think very few people customize user directory environment variables anyway, especially if they're ignored by other applications. In any case, the change will be documented in the release notes.

Alternatively, I could introduce an option to control whether user-dirs.dirs has priority. However, I think it clutters the package interface unnecessarily.

from xdg.

kajes avatar kajes commented on June 9, 2024

Any updates on this? I recently found this library and I guess I'm one of the edge cases that need the parsing of user-dirs.dirs.

from xdg.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.