Coder Social home page Coder Social logo

dirs-dev / dirs-sys-rs Goto Github PK

View Code? Open in Web Editor NEW
38.0 4.0 23.0 24 KB

system-level helper functions for the dirs and directories crates

Home Page: https://dirs.dev

License: Apache License 2.0

Rust 100.00%
knownfolders xdg-basedir xdg-user-dirs

dirs-sys-rs's People

Contributors

adminxvii avatar coolreader18 avatar fnichol avatar guilherme-vasconcelos avatar jackpot51 avatar kayabanerve avatar lberrymage avatar mggmuggins avatar nickelc avatar soc avatar tmiasko avatar tspiteri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dirs-sys-rs's Issues

XDG user dirs should default to `$HOME`

If ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs does not exist, or lacks the specified key (e.g. XDG_DOWNLOAD_DIR), the behaviour of xdg-user-dir the CLI program is to output $HOME.

In the same case, the behaviour of dirs::download_dir() (for example) is to return None.

There's no specification as such for '"well known" user directories', but it's implied that this is the intended fall-back behaviour:

Note: To disable a directory, point it to the homedir.

https://www.freedesktop.org/wiki/Software/xdg-user-dirs/

cf. tauri-apps/tauri#3090, xdg-rs/dirs#56 (I opened there as that's what I'm using, via tauri, but it seems to affect dirs too, so I've copied here.)

Missing CoTaskMemFree?

PS C:\Users\steve> wasmer create-exe test.wasm -o test.exe --target x86_64-pc-windows-gnu --llvm
Cached tarball to cache path `C:\Users\steve\scoop\apps\wasmer\current\cache\wasmer-windows-gnu64.tar.gz`.
Compiler: llvm
Target: x86_64-pc-windows-gnu
Format: Symbols
Library Path: C:\Users\steve\scoop\apps\wasmer\current\cache\wasmer-windows-gnu64\lib\libwasmer.a
Using zig binary: C:\Users\steve\scoop\shims\zig.exe
Using zig target triple: x86_64-windows-gnu
error: error: lld-link: undefined symbol: CoTaskMemFree
>>> referenced by libwasmer.a(dirs_sys-ad4d6117404657e1.dirs_sys.3e403b3a-cgu.1.rcgu.o):(dirs_sys::target_windows::known_folder::h1663f056389cb40d)
>>> referenced by libwasmer.a(dirs_sys-ad4d6117404657e1.dirs_sys.3e403b3a-cgu.1.rcgu.o):(dirs_sys::target_windows::known_folder::h1663f056389cb40d)
>>> referenced by libwasmer.a(dirs_sys-ad4d6117404657e1.dirs_sys.3e403b3a-cgu.1.rcgu.o):(dirs_sys::target_windows::known_folder_profile::h94e80d06b999375b)
>>> referenced 21 more times

The error message leads me here

`option-ext` dependency

dirs-sys 0.4.1 was just released and comes w/ a new dependency option-ext. I think this is a bit unfortunate due to two reasons:

  1. dependency bloat: dirs-sys is a rather low-level crate and just pulling a unused dependency just for a bit of Option convenience seems a bit excessive. Note that option-ext was basically unused by the Rust ecosystem prior to this release:
    image
  2. license: while dirs-sys (and all other dirs-dev project) are licensed under Apache2 + MIT (which is the de facto default for the Rust ecosystem), option-ext is MPL which is a copyleft license.

I can file a fix PR if this is OK w/ the maintainers.

Borked on *nix that isn't Linux nor Redox

dirs_sys::user_dir is only defined for Linux and Redox.

error[E0425]: cannot find function `user_dir` in module `dirs_sys`
  --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/dirs-2.0.0/src/lin.rs:17:56
   |
17 | pub fn audio_dir()      -> Option<PathBuf> { dirs_sys::user_dir("MUSIC") }
   |                                                        ^^^^^^^^ not found in `dirs_sys`

error[E0425]: cannot find function `user_dir` in module `dirs_sys`
  --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/dirs-2.0.0/src/lin.rs:18:56
   |
18 | pub fn desktop_dir()    -> Option<PathBuf> { dirs_sys::user_dir("DESKTOP") }
   |                                                        ^^^^^^^^ not found in `dirs_sys`

error[E0425]: cannot find function `user_dir` in module `dirs_sys`
  --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/dirs-2.0.0/src/lin.rs:19:56
   |
19 | pub fn document_dir()   -> Option<PathBuf> { dirs_sys::user_dir("DOCUMENTS") }
   |                                                        ^^^^^^^^ not found in `dirs_sys`

error[E0425]: cannot find function `user_dir` in module `dirs_sys`
  --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/dirs-2.0.0/src/lin.rs:20:56
   |
20 | pub fn download_dir()   -> Option<PathBuf> { dirs_sys::user_dir("DOWNLOAD") }
   |                                                        ^^^^^^^^ not found in `dirs_sys`

error[E0425]: cannot find function `user_dir` in module `dirs_sys`
  --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/dirs-2.0.0/src/lin.rs:22:56
   |
22 | pub fn picture_dir()    -> Option<PathBuf> { dirs_sys::user_dir("PICTURES") }
   |                                                        ^^^^^^^^ not found in `dirs_sys`

error[E0425]: cannot find function `user_dir` in module `dirs_sys`
  --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/dirs-2.0.0/src/lin.rs:23:56
   |
23 | pub fn public_dir()     -> Option<PathBuf> { dirs_sys::user_dir("PUBLICSHARE") }
   |                                                        ^^^^^^^^ not found in `dirs_sys`

error[E0425]: cannot find function `user_dir` in module `dirs_sys`
  --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/dirs-2.0.0/src/lin.rs:24:56
   |
24 | pub fn template_dir()   -> Option<PathBuf> { dirs_sys::user_dir("TEMPLATES") }
   |                                                        ^^^^^^^^ not found in `dirs_sys`

error[E0425]: cannot find function `user_dir` in module `dirs_sys`
  --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/dirs-2.0.0/src/lin.rs:25:56
   |
25 | pub fn video_dir()      -> Option<PathBuf> { dirs_sys::user_dir("VIDEOS") }
   |                                                        ^^^^^^^^ not found in `dirs_sys`

dirs-sys 0.4.1 introduces an MPL-licensed dependency not compatible with MIT/Apache 2.0

e169da7 introduced a dependency on option-ext. That crate is licensed under the Mozilla Public License 2.0, a weak-copyleft license that is more restrictive than either MIT or Apache 2.0.

(Although MPL is a file-level license that is not "viral" to projects using it as long as the files in question are not changed, the fact remains that it's more restrictive; for example, MIT allows sublicensing and MPL 2.0 does not.)

As a result, we (zcash/zcash) cannot upgrade to dependencies using dirs-sys 0.4.1 because it would violate our licensing policy. This is particularly problematic because according to semver, 0.4.1 is supposed to be a non-breaking release from 0.4.0, which did not have the MPL dependency.

option-ext is MPL 2.0 licensed which is a copyleft dependency licence

Not sure how propagating licences work, but since dirs-rs depends on dirs-sys which depends on option-ext, which is using MPL 2.0 licensce. This cannot be used in closed source projects.
I sadly have no way around this and cannot open source what I use, so I cannot use dirs-rs due to this.

Afaik rust 1.76 has inspect on option types which can replace this dependency.

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.