# \[Pre-ANN/RFC\] XDG.jl: A cross platform implementation of the XDG Directory Spec

**URL:** <https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027>\
**Category:** Package Announcements\
**Tags:** package, announcement\
**Created:** [February 4, 2023, 5:03am UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027 "2023-02-04T05:03:44Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)\
**Post date:** [March 4, 2023, 2:28pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/21 "2023-03-04T14:28:47Z")

</div>

If you want to introduce the `Dirs` module only to have it shorter than `StandardDirectories`, it feels somewhat artificial, and using `import StandardDirectories as XDG` or `import StandardDirectories as Dirs` is an alternative.

Like it was mentioned, short package names with cryptic letters are generally not great, but I like `XDG` here, as afaict it’s much more known that its non-abbreviated form (and `CrossDesktopGroup` would be an horrible package name here), and any other name will not make me understand what this package does better than just `XDG`. And if I’m looking for this functionality, i would naturally search something like “julia XDG”.

The fact that this package doesn’t serve only a niche scientific discipline makes it even more acceptable to use a short name. Short names are precious, but only if they can be given to packages when they fit the name obviously, as is the case here I think.

---

<div class="post-metadata">

**Author:** ![ederag](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ederag/32/4106_2.png) [@ederag](https://discourse.julialang.org/u/ederag)\
**Post date:** [March 4, 2023, 5:52pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/22 "2023-03-04T17:52:12Z")

</div>

> Arguably this is bikeshedding, but I personally don’t like regretting naming decisions.

An alternative would be to export functions with prefixes, such as `xdg_user_config()` ?  
This is short, and separates the package name from the API  
(since we can’t do something like `using XDGPaths as XDG`).

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [March 4, 2023, 6:05pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/23 "2023-03-04T18:05:28Z")

</div>

Hmm, I feel like `?.User.config()` is much nicer, particularly considering the counterpart `?.System.config()` etc.

---

<div class="post-metadata">

**Author:** ![ederag](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ederag/32/4106_2.png) [@ederag](https://discourse.julialang.org/u/ederag)\
**Post date:** [March 4, 2023, 8:45pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/24 "2023-03-04T20:45:09Z")

</div>

> I feel like `?.User.config()` is much nicer, particularly considering the counterpart `?.System.config()`

That would be `xdg_system_config()`, which would be as discoverable,  
and in my eyes more readable. Maybe it’s cultural, or I’m missing something.

Others seem to favor your proposal, and you’re doing great, so please don’t be disturbed  
and pick anything you like !

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [March 7, 2023, 4:26pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/25 "2023-03-07T16:26:46Z")

</div>

The rumination continues, `BaseDirs` is currently in the lead.

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [June 3, 2023, 8:12pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/26 "2023-06-03T20:12:35Z")

</div>

I want to say that I just looked though the docs, and it looks to me like you have done really good and thurough work, both in implementation and documentation. Thank you!

---

<div class="post-metadata">

**Author:** ![Diego\_Javier\_Zea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diego_javier_zea/32/1858_2.png) [@Diego\_Javier\_Zea](https://discourse.julialang.org/u/Diego_Javier_Zea)\
**Post date:** [June 3, 2023, 11:14pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/27 "2023-06-03T23:14:23Z")

</div>

Hi! Could this package help putting Julia scripts in the PATH? I guess it can offer a bin function similar to the config one for that. Cheers

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [June 4, 2023, 11:38am UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/28 "2023-06-04T11:38:01Z")

</div>

Let me know if this example answers your question 🙂

```julia
julia> jexec = BaseDirs.User.bin("jl-hello-world")
"/home/tec/.local/bin/jl-hello-world"

julia> write(BaseDirs.User.bin("jl-hello-world"), 
       "#!/usr/bin/env -S julia --startup-file=no\n\
        println(\"Hello world!\")\n")
66

julia> chmod(jexec, 0o755)
"/home/tec/.local/bin/jl-hello-world"

julia> run(`jl-hello-world`)
Hello world!
Process(`jl-hello-world`, ProcessExited(0))

julia> rm(jexec)

```

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [June 4, 2023, 12:02pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/29 "2023-06-04T12:02:37Z")

</div>

Prompted by this question, I’m considering making `create=true` also set executability with `bin`, which would reduce the earlier example to:

```julia-repl
julia> write(BaseDirs.User.bin("jl-hello-world", create=true),
             "#!/usr/bin/env -S julia --startup-file=no\n\
              println(\"Hello world!\")\n")

julia> run(`jl-hello-world`)
Hello world!
Process(`jl-hello-world`, ProcessExited(0))

```

---

<div class="post-metadata">

**Author:** ![Diego\_Javier\_Zea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diego_javier_zea/32/1858_2.png) [@Diego\_Javier\_Zea](https://discourse.julialang.org/u/Diego_Javier_Zea)\
**Post date:** [June 4, 2023, 2:01pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/30 "2023-06-04T14:01:43Z")

</div>

Oh! That is awesome! 😃

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [June 5, 2023, 12:35pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027/31 "2023-06-05T12:35:41Z")

</div>

In a bit (once General merges the PR) v1.1 will be released, which just adds the “make created bin files executable” behaviour discussed above, and removes the two sources of compilation at load-time.

[Previous page](https://discourse.julialang.org/t/pre-ann-rfc-xdg-jl-a-cross-platform-implementation-of-the-xdg-directory-spec/94027.md?page=1)
