Config-Find

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - add Config::Find::Where->lib_dir method
        - Config::Find::Where->application_dir documented
        - update to use new File::HomeDir API

0.22    2005-09-22
        - pod errors corrected on Config::Find::Where and now using
          Test::Pod for automatically finding those errors.

0.21    2005-08-08
        - added work around on WinAny module when ${APPDATA} or
          ${LOCAL_APPDATA} point to the user desktop to ignore them.

0.20    2005-07-27
        - look for ~/.foo.conf and ~/.foo.cfg in addition to ~/.foo

0.19    2005-07-13
        - bug on look_for_dir_file passing the wrong app name to
          app_dir.

0.18    2005-04-13
        - bug on parent_dir('') going to an inf. loop corrected.

lib/Config/Find/WinAny.pm  view on Meta::CPAN

    unless defined $name;

    my $ename = uc($name).'_HOME';
    return $ENV{$ename} if (exists $ENV{$ename});
    $class->guess_script_dir;
}

my $winlocalappdir=Win32::GetFolderPath(CSIDL_LOCAL_APPDATA);
my $winappdir=Win32::GetFolderPath(CSIDL_APPDATA);

my $windesktop=Win32::GetFolderPath(CSIDL_DESKTOPDIRECTORY);

if (defined $windesktop and $windesktop ne '') {
    undef $winlocalappdir   if (defined($winlocalappdir) and index($winlocalappdir, $windesktop) == 0);
    undef $winappdir        if (defined($winappdir)      and index($winappdir, $windesktop) == 0);
}

sub app_user_dir {
    my ($class, $name)=@_;
    return ( (defined $winlocalappdir) && ($winlocalappdir ne "") ? $winlocalappdir :
         (defined $winappdir) && ($winappdir ne "") ? $winappdir :
         File::Spec->catdir($class->app_dir($name),
                'Users',
                $class->my_getlogin));
}

lib/Config/Find/WinAny.pm  view on Meta::CPAN


Note: entries marked as 1b were the default behaviour for versions of
Config::Find until 0.14. New behaviour is to put user application
configuration data under ${LOCAL_APPDATA} as returned by
C<Win32::GetFolderPath(CSIDL_LOCAL_APPDATA)> (if this call fails, the
old approach is used).  Also, global configuration files were stored
under a new directory placed in the same directory as the script but
this is unnecessary because windows apps already go in their own
directory.

It seems that, sometimes, ${LOCAL_APPDATA} points to the user desktop
and placing configuration files there would be obviously wrong. As a
work around, the module will ignore ${LOCAL_APPDATA} or ${APPDATA} if
they point to any place below the desktop path.

=head1 SEE ALSO

L<Config::Find>, L<Config::Find::Any>

=head1 AUTHOR

Salvador FandiE<ntilde>o GarcE<iacute>a, E<lt>sfandino@yahoo.comE<gt>

=head1 CONTRIBUTORS



( run in 0.667 second using v1.01-cache-2.11-cpan-299005ec8e3 )