The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

# Provides common functionality needed for Portable Perl support
use 5.008;
use strict;
use File::Spec 3.21 (); # 3.21 needed for volume-safe abs2rel
use Params::Util ();
our $VERSION = '1.02';
sub freeze {
return shift unless defined Params::Util::_STRING( $_[0] );
File::Spec->abs2rel( shift, Padre::Constant::PORTABLE );
}
sub thaw {
return shift unless defined Params::Util::_STRING( $_[0] );
File::Spec->rel2abs( shift, Padre::Constant::PORTABLE );
}
# Special case for situations where the value might be a directory
# and MIGHT be the same as the portable root directory.
sub freeze_directory {
return shift unless defined Params::Util::_STRING( $_[0] );
my $rel = File::Spec->abs2rel( shift, Padre::Constant::PORTABLE );
return length($rel) ? $rel : File::Spec->curdir;
}
1;
# Copyright 2008-2016 The Padre development team as listed in Padre.pm.
# LICENSE
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl 5 itself.