1File::UserDirs(3) User Contributed Perl Documentation File::UserDirs(3)
2
3
4
6 File::UserDirs - find extra media and documents directories
7
9 This document describes File::UserDirs version 0.04.
10
12 use File::UserDirs qw(:all);
13 print xdg_desktop_dir; # e.g. /home/user/Desktop
14
16 This module can be used to find directories as informally specified by
17 the Freedesktop.org xdg-user-dirs software. This gives a mechanism to
18 locate extra directories for media and documents files.
19
21 "xdg_desktop_dir"
22 Returns the desktop directory. Unless changed by the user, this is
23 the directory Desktop in the home directory.
24
25 "xdg_documents_dir"
26 Returns the documents directory. Unless changed by the user, this
27 is the home directory.
28
29 "xdg_download_dir"
30 Returns the download directory. Unless changed by the user, this is
31 the home directory.
32
33 "xdg_music_dir"
34 Returns the music directory. Unless changed by the user, this is
35 the home directory.
36
37 "xdg_pictures_dir"
38 Returns the pictures directory. Unless changed by the user, this is
39 the home directory.
40
41 "xdg_publicshare_dir"
42 Returns the public share directory. Unless changed by the user,
43 this is the home directory.
44
45 "xdg_templates_dir"
46 Returns the templates directory. Unless changed by the user, this
47 is the home directory.
48
49 "xdg_videos_dir"
50 Returns the videos directory. Unless changed by the user, this is
51 the home directory.
52
54 None by default, but any method can be exported on demand. Also the
55 group ":all" is defined which exports all methods.
56
58 ""xdg-user-dir" failed to start: %s"
59 The executable "xdg-user-dir" could not be run, most likely because
60 it was not installed. See "DEPENDENCIES".
61
63 The location of the directories can be specified by the user in the
64 file $XDG_CONFIG_HOME/user-dirs.dirs. It is a shell file setting a
65 number of environment variables. To find the exact pathname from Perl,
66 run:
67
68 use File::BaseDir qw(config_home);
69 print config_home('user-dirs.dirs');
70
71 Example customised user-dirs.dirs
72 XDG_DESKTOP_DIR="$HOME/Workspace"
73 XDG_DOCUMENTS_DIR="$HOME/Files"
74 XDG_DOWNLOAD_DIR="$HOME/Files/Downloads"
75 XDG_MUSIC_DIR="$HOME/Files/Audio"
76 XDG_PICTURES_DIR="$HOME/Files/Images"
77 XDG_PUBLICSHARE_DIR="$HOME/public_html"
78 XDG_TEMPLATES_DIR="$HOME/Files/Document templates"
79 XDG_VIDEOS_DIR="$HOME/Files/Video"
80
82 This module requires the executable xdg-user-dir from the package
83 "xdg-user-dirs". Source code is available from
84 <http://cgit.freedesktop.org/xdg/xdg-user-dirs/>.
85
87perl v5.28.0 2018-07-14 File::UserDirs(3)