diff options
Diffstat (limited to 'ACE/bin/ChangeLogEditor/FileLocator.pm')
-rw-r--r-- | ACE/bin/ChangeLogEditor/FileLocator.pm | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/ACE/bin/ChangeLogEditor/FileLocator.pm b/ACE/bin/ChangeLogEditor/FileLocator.pm new file mode 100644 index 00000000000..5707a84c345 --- /dev/null +++ b/ACE/bin/ChangeLogEditor/FileLocator.pm @@ -0,0 +1,77 @@ +package FileLocator; + +# ************************************************************ +# Description : Base class for file locators. +# Author : Chad Elliott +# Create Date : 6/18/2002 +# ************************************************************ + +# ************************************************************ +# Pragmas +# ************************************************************ + +use strict; +use FileHandle; + +# ************************************************************ +# Subroutine Section +# ************************************************************ + +sub new { + my($class) = shift; + my($self) = bless { + }, $class; + return $self; +} + + +sub tmpnam { + my($self) = shift; + my($file) = shift; + my(@def) = ("/tmp", "."); + + foreach my $possible ($ENV{TMPDIR}, $ENV{TEMP}, $ENV{TMP}, @def) { + if (defined $possible && -d $possible && -w $possible) { + $possible =~ s!\\!/!g; + return $possible . '/' . $$ . '_' . $> . '_' . $file;; + } + } + + return $file; +} + + +sub process_errors { + my($self) = shift; + my($file) = shift; + my($error) = undef; + + if (-s $file != 0) { + my($fh) = new FileHandle(); + if (open($fh, $file)) { + $error = ''; + while(<$fh>) { + $error .= $_; + } + close($fh); + $error =~ s/\s+$//; + } + } + unlink($file); + + return $error; +} + + +sub locate { + my($self) = shift; + my(@dirs) = @_; + my(@modified) = (); + my(@removed) = (); + my(@conflicts) = (); + my(@unknown) = (); + return \@modified, \@removed, \@conflicts, \@unknown; +} + + +1; |