DirsOfInterest
NAME
DirsOfInterest
Synopsis
use DirsOfInterest;
say DirsOfInterest.user-data-dir; # /home/boeker/.local/share
say DirsOfInterest.site-data-dirs; # /usr/local/share/
# /usr/share/
# /var/lib/snapd/desktop
say DirsOfInterest.site-data-dir; # /usr/local/share/
say DirsOfInterest.user-config-dir; # /home/boeker/.config
say DirsOfInterest.site-config-dirs; # /etc/xdg
say DirsOfInterest.site-config-dir; # /etc/xdg
say DirsOfInterest.user-cache-dir; # /home/boeker/.cache
say DirsOfInterest.site-cache-dir; # /var/cache
say DirsOfInterest.user-state-dir; # /home/boeker/.local/state
say DirsOfInterest.user-log-dir; # /home/boeker/.local/state/log
say DirsOfInterest.user-documents-dir; # /home/boeker/Documents
say DirsOfInterest.user-downloads-dir; # /home/boeker/Downloads
say DirsOfInterest.user-pictures-dir; # /home/boeker/Pictures
say DirsOfInterest.user-videos-dir; # /home/boeker/Videos
say DirsOfInterest.user-music-dir; # /home/boeker/Music
say DirsOfInterest.user-desktop-dir; # /home/boeker/Desktop
say DirsOfInterest.user-runtime-dir; # /run/user/1001
say DirsOfInterest.site-runtime-dir; # /run
# Globally set options
DirsOfInterest.set:
app-author => 'JunkWorks',
app-name => 'Dunkinstuff',
version => '1.0.7',
roaming => True,
ensure-exists = True,
;
say DirsOfInterest.user-data-dir;
# /home/boeker/.local/share/Dunkinstuff/1.0.7
# Options in a separate object
my $doi = DirsOfInterest.new: app-name => 'Dunkinstuff';
say $doi.user-data-dir;
# /home/boeker/.local/share/Dunkinstuff
Description
Find directories of public interest.
Configuration
To customize the behavior of DoI, set options. The options can either be set
globally, affecting all following calls via DirsOfInterest.method:
DirsOfInterest.set: app-name => 'Dunkinstuff';
or by creating a new object with the respective options set:
my $doi = DirsOfInterest.new: app-name => 'Dunkinstuff';
Available options are:
app-author- Name of the entity of the software. Ends up in some paths depending on the platform.
app-name- Name of the the software. Ends up in some paths depending on the platform.
app-version- Version of the the software. Ends up in some paths depending on the platform.
roaming- When set to
True, will pick the roaming directory where applicable. At the moment that's only theuser-data-diron Windows.
ensure-exists- When set to
True, will create the directory should it not exist. This is especially helpful when also settingapp-author,app-nameorapp-version.
AUTHOR
Patrick Böker <[email protected]>
Originally based on File::HomeDir by Ahmad M. Zawawi and the
PlatformDirs Python module.
License
This module is distributed under the terms of the Artistic License 2.0.
Both File::HomeDir, PlatformDirs are licensed under the MIT license
reproduced here:
MIT License
Copyright (c) 2010-202x The platformdirs developers # in the case of PlatformDirs Copyright (c) 2016 Ahmad M. Zawawi # in the case of File::HomeDirs
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.