Implementation fixes for TIC processing

This commit is contained in:
Deon George
2022-11-03 22:05:49 +11:00
parent 7571a2cd7d
commit 34f289953d
5 changed files with 17 additions and 14 deletions

View File

@@ -61,6 +61,8 @@ class Tic extends FTNBase
private Address $to; // Should be me
public function __construct(private string $filename) {
Log::info(sprintf('%s:Processing TIC file [%s]',self::LOGKEY,$filename));
$fo = new File;
$fo->kludges = collect();
@@ -70,19 +72,17 @@ class Tic extends FTNBase
$fo->rogue_seenby = collect();
list($hex,$name) = explode('-',$filename);
$ticfullpath = $this->fullpath($filename);
$hex = basename($hex);
if (! file_exists($ticfullpath))
throw new FileNotFoundException(sprintf('%s:File [%s] doesnt exist',self::LOGKEY,realpath($ticfullpath)));
if (! file_exists($filename))
throw new FileNotFoundException(sprintf('%s:File [%s] doesnt exist',self::LOGKEY,realpath($filename)));
if (! is_writable($ticfullpath))
throw new UnableToWriteFile(sprintf('%s:File [%s] is not writable',self::LOGKEY,realpath($ticfullpath)));
if (! is_writable($filename))
throw new UnableToWriteFile(sprintf('%s:File [%s] is not writable',self::LOGKEY,realpath($filename)));
Log::info(sprintf('Processing TIC file [%s]',$ticfullpath));
$f = fopen($ticfullpath,'rb');
$f = fopen($filename,'rb');
if (! $f) {
Log::error(sprintf('%s:! Unable to open file [%s] for writing',self::LOGKEY,$ticfullpath));
Log::error(sprintf('%s:! Unable to open file [%s] for writing',self::LOGKEY,$filename));
return;
}