1File::UserDirs(3) User Contributed Perl Documentation File::UserDirs(3)
2
3
4
6 File::UserDirs - Find extra media and documents directories
7
9 version 0.09
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 May be exported on request. Also the group ":all" is defined which
22 exports all methods.
23
24 xdg_desktop_dir
25 my $dir = xdg_desktop_dir;
26
27 Returns the desktop directory. Unless changed by the user, this is the
28 directory Desktop in the home directory.
29
30 xdg_documents_dir
31 my $dir = xdg_documents_dir;
32
33 Returns the documents directory. Unless changed by the user, this is
34 the home directory.
35
36 xdg_download_dir
37 my $dir = xdg_download_dir;
38
39 Returns the download directory. Unless changed by the user, this is the
40 home directory.
41
42 xdg_music_dir
43 my $dir = xdg_music_dir;
44
45 Returns the music directory. Unless changed by the user, this is the
46 home directory.
47
48 xdg_pictures_dir
49 my $dir = xdg_pictures_dir;
50
51 Returns the pictures directory. Unless changed by the user, this is the
52 home directory.
53
54 xdg_publicshare_dir
55 my $dir = xdg_publicshare_dir;
56
57 Returns the public share directory. Unless changed by the user, this is
58 the home directory.
59
60 xdg_templates_dir
61 my $dir = xdg_templates_dir;
62
63 Returns the templates directory. Unless changed by the user, this is
64 the home directory.
65
66 xdg_videos_dir
67 my $dir = xdg_videos_dir;
68
69 Returns the videos directory. Unless changed by the user, this is the
70 home directory.
71
73 ""xdg-user-dir" failed to start: %s"
74 The executable "xdg-user-dir" could not be run, most likely because
75 it was not installed. See "DEPENDENCIES".
76
78 The location of the directories can be specified by the user in the
79 file $XDG_CONFIG_HOME/user-dirs.dirs. It is a shell file setting a
80 number of environment variables. To find the exact pathname from Perl,
81 run:
82
83 use File::BaseDir qw(config_home);
84 print config_home('user-dirs.dirs');
85
86 Example customised user-dirs.dirs
87 XDG_DESKTOP_DIR="$HOME/Workspace"
88 XDG_DOCUMENTS_DIR="$HOME/Files"
89 XDG_DOWNLOAD_DIR="$HOME/Files/Downloads"
90 XDG_MUSIC_DIR="$HOME/Files/Audio"
91 XDG_PICTURES_DIR="$HOME/Files/Images"
92 XDG_PUBLICSHARE_DIR="$HOME/public_html"
93 XDG_TEMPLATES_DIR="$HOME/Files/Document templates"
94 XDG_VIDEOS_DIR="$HOME/Files/Video"
95
97 This module requires the executable xdg-user-dir from the package
98 "xdg-user-dirs". Source code is available from
99 <http://cgit.freedesktop.org/xdg/xdg-user-dirs/>.
100
102 • Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>
103
104 • Graham Ollis <plicease@cpan.org>
105
107 This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus
108 [Larus] <pardus@cpan.org>.
109
110 This is free software; you can redistribute it and/or modify it under
111 the same terms as the Perl 5 programming language system itself.
112
113
114
115perl v5.36.0 2022-07-22 File::UserDirs(3)