#!/usr/bin/perl use strict; use warnings; use Panotools::Script; use File::Spec; my ($pto_in, $pto_out) = @ARGV; my $pto = new Panotools::Script; $pto->Read ($pto_in); my ($volume, $directories, $file) = File::Spec->splitpath ($pto_out); my $base = $volume . $directories; for my $image (@{$pto->Image}) { my $abs_path = $image->{n}; $abs_path =~ s/(^"|"$)//g; my $rel_path = '"'. File::Spec->abs2rel ($abs_path, $base) .'"'; $image->Set (n => $rel_path); } $pto->Write ($pto_out); __END__ =head1 NAME ptopath - removes absolute paths from .pto projects =head1 Synopsis ptopath project_in.pto project_out.pto =head1 DESCRIPTION Rewrites 'n' parameters of 'i' lines, swapping absolute paths with paths relative to the .pto file itself =head1 Calling syntax ptopath (input and output can be the same file) =head1 License This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. =head1 See Also L =head1 Author Bruno Postle, Ebruno (at) postle.netE =cut