Snog
Well-known member
OK, I'm working on add-ons little by little to bring them into full compliance with XF2 development standard, and I wasn't able to find a way to append data to a file using the XF2 FILE system, so I tried the flysystem directly.
This works on my development server (with proper USE statements in class)...
Having never used the flysystem and without much info available that I can find, my question is regarding the path. It bothers me that FILE uses the abstracted path to write files, yet I'm declaring a direct path in that code.
Is there a better way to declare/get the path?
This works on my development server (with proper USE statements in class)...
Code:
$adapter = new Local('data/mydirectory/', FILE_APPEND);
$fs = new Filesystem($adapter);
$filename = 'my.file';
if($fs->has($filename))
{
$fs->update($filename, $somecontent);
}
else
{
$fs->write($filename, $somecontent);
}
Having never used the flysystem and without much info available that I can find, my question is regarding the path. It bothers me that FILE uses the abstracted path to write files, yet I'm declaring a direct path in that code.
Is there a better way to declare/get the path?