Opened 6 years ago

Closed 2 years ago

#5966 closed bug (fixed)

getAppUserDataDirectory does not respect XDG specification

Reported by: ordcoder Owned by:
Priority: normal Milestone: 8.0.1
Component: Core Libraries Version: 7.4.1
Keywords: Cc: pho@…, core-libraries-committee@…, ekmett
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking: #6077
Related Tickets: Differential Rev(s):
Wiki Page:

Description

getAppUserDataDirectory function from System.Directory module returns path to a dot-dir under home directory. This swamps home with many hidden directories, when there are many applications installed. There is XDG specification for this situation, which suggests using $XDG_DATA_HOME environment variable.

So, getAppUserDataDirectory should behave approximately like this when $XDG_DATA_HOME is set:

getAppUserDataDirectory appName = do
    path <- getEnv "XDG_DATA_HOME"
    return (path++'/':appName)

Change History (15)

comment:1 Changed 6 years ago by simonmar

difficulty: Unknown
Milestone: 7.6.1

To do this properly, we should really add getAppConfigDirectory, getAppCacheDirectory etc.

comment:2 Changed 6 years ago by ordcoder

There is library implementing this functionality. It may be of some help.

comment:3 Changed 6 years ago by PHO

Cc: pho@… added

comment:4 Changed 6 years ago by simonmar

See also #6077, which asks for XDG_CONFIG_HOME support.

comment:5 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:6 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:7 Changed 3 years ago by god

Blocking: 6077 added

comment:8 Changed 3 years ago by thoughtpolice

Component: libraries/directoryCore Libraries
Owner: set to ekmett

Moving over to new owning component 'Core Libraries'.

comment:9 Changed 3 years ago by hvr

Cc: core-libraries-committee@… added
Status: newupstream

comment:10 Changed 3 years ago by hvr

Milestone: 7.10.17.12.1

There's still unresolved issues on how to properly address this one. Better punt this to milestone:7.12.1

comment:11 Changed 2 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:12 Changed 2 years ago by thomie

Owner: ekmett deleted

comment:13 Changed 2 years ago by hvr

Cc: ekmett added
Status: upstreamnew

directory now provides primitives to query XDG dirs, so now the ball is again in GHC's court to decide how/whether to support XDG dirs.

comment:14 Changed 2 years ago by dolio

Isn't this still a report about directory? I think it was decided for the upstream issue that changing the behavior of getAppUserDataDirectory would silently break things, so it was better to add the XDG querying functions for people to use rather than switch this function. So should this issue be closed?

If the reason it's open is GHC placing its files in XDG directories, that is #6077 as mentioned by simonmar above.

comment:15 in reply to:  14 Changed 2 years ago by hvr

Resolution: fixed
Status: newclosed

Replying to dolio:

If the reason it's open is GHC placing its files in XDG directories, that is #6077 as mentioned by simonmar above.

you're right... I missed that

Note: See TracTickets for help on using tickets.