Ferreteria/v0.6/clade/Sys/FileSys/Node/@code/rmv/2026/07/25
Jump to navigation
Jump to search
| 2026/07/24 | 2026/07/25 | 2026/07/26 |
This is stuff is rather in the way, though some of it may end up being needed later. Maybe. It was commented out on 2026-07-19.
#
/* ErrCardClass */ #use Woozalia\Ferret\Sys\Diag\Break\Native\cLegacy as ErrCardClass;
/* Maker* [c,i] */ #use Woozalia\Ferret\Sys\FileSys\Node\aux\{ cMaker as MakerClass, iMaker as MakerIface };
/* NAspexIface */ #use Woozalia\Ferret\Sys\FileSys\Node\aux\iAspex as AspexIface;
/* NodeFiX* [c,i] */ #use Woozalia\Ferret\Sys\FileSys\Node\aux\{ txFi as NodeFiXTrait, ixFi as NodeFiXIface };
/* NodeFoX* [c,i] */ #use Woozalia\Ferret\Sys\FileSys\Node\aux\{ txFo as NodeFoXTrait, ixFo as NodeFoXIface };
/* NdFil* [c,i] */ #use Woozalia\Ferret\Sys\FileSys\Node\aux\{ cFil as NdFilClass, iFil as NdFilIface };
/* NdFol* [c,i] */ #use Woozalia\Ferret\Sys\FileSys\Node\aux\{ cFol as NdFolClass, iFol as NdFolIface };
/* NdInfoIface */ #use Woozalia\Ferret\Sys\FileSys\Aspect\Venue\aux\iNodeInfo as NdInfoIface;
/* Ident* [c,i] */ #use Woozalia\Ferret\Sys\FileSys\Aspect\{ cIdent as IdentClass, iIdent as IdentIface };
/* InOutIface */ #use Woozalia\Ferret\Sys\FileSys\Aspect\iInOut as InOutIface;
/* ProtoAdmin */ #use Woozalia\Ferret\Sys\FileSys\Aspect\caVenue as ProtoAdmin;
/* RowView* [c,i,t] */ #use Woozalia\Ferret\Sys\Data\Things\Array\View\{ cRow as RowViewClass, iRow as RowViewIface, tRow as RowViewTrait };
/* Stream* [c,i] */ #use Woozalia\Ferret\IO\Aspect\Connx\Stream\Native\{ cFile as StreamClass, iFile as StreamIface };
/* Venue* [ca,i] */ #use Woozalia\Ferret\Sys\FileSys\Aspect\{ caVenue as VenueAdmin, iVenue as VenueIface };
...
#
// 2026-06-08 I do not expect this to work properly yet.
public static function FromOUSpec(SpecUIface $o) : SelfIface {
$oThis = static::FromSUSpec_asWild($o->SUSpec);
$oThis->OIdent->OUSpec = $o;
$oThis->WithSUSpec($o->SUSpec);
return $oThis;
}
public static function FromOSpecs(SpecUIface $oUS, SpecPIface $oPS) : SelfIface {
$oThis = new static;
// Since we can't really access the necessary filesystem, we have to make an assumption:
$isFldr = $oPS->HasFldrMk;
$oThis->IsFile = !$isFldr;
$oThis->IsFolder = $isFldr;
$oID = $oThis->OIdent;
$oID->OUSpec = $oUS;
$oID->OPSoec = $oPS;
$oThis->WithSUSpec($oUS->SUSpec);
return $oThis;
}
// Used by Iter, so we can iterate with a FilesystemIterator.
// 2026-06-06 TODO: Determine if that even works with Venues other than Local.
public static function FromSplInfo(SplFileInfo $on) : SelfIface {
if ($on->IsDir()) {
$sc = static::NodeFoClass();
} elseif ($on->IsFile()) {
$sc = static::NodeFiClass();
} else {
$this->CodingPrompt('Not sure what conditions might cause this...');
}
$oThis = new $sc;
$oThis->SUSpec = $on->getPathname();
return $oThis;
}
protected static function FromExisting(SelfIface $o) : SelfIface {
$oVenue = $o->OVenue;
// 2026-06-06 should this code go somewhere more generally accessible?
// 2026-06-21 If ErrCardClass doesn't have a pseudoconstructor for this, it should.
$a = error_get_last();
if (is_array($a)) {
// handle error
$oErr = ErrCardClass::FromArray($a);
$oErr->AmHere('ERROR: '.$oErr->Render()); die();
} else {
if ($oVenue->IsFile) {
$sc = static::NodeFiClass();
} elseif ($oVenue->IsFolder) {
$sc = static::NodeFoClass();
} else {
echo self::CodingPrompt("Node type for [$fs] needs to be handled."); die();
}
$oThis = new $sc;
$oThis->OVenue = $oVenue; // might as well recycle the Venue object
$oThis->WithSame($o);
return $oThis;
}
}
protected static function FromNotFound(SelfIface $o) : SelfIface {
// Node not found; assume folder if there's an ending slash
$fs = $o->SUSpec;
$isFldr = str_ends_with($fs,DIRECTORY_SEPARATOR);
if ($isFldr) {
$sc = static::NodeFoClass();
} else {
$sc = static::NodeFiClass();
}
$oThis = new $sc;
$oThis->WithSUSpec($fs);
return $oThis;
}
// ++ SETUP: dynamic ++ //
protected function WithSame(SelfIface $o) : void {
$this->SUSpec = $o->SUSpec;
}