mirror of
https://github.com/fluffos/fluffos
synced 2026-08-12 18:26:06 -04:00
resolve(), async_read(), async_write(), async_getdir() and async_db_exec() ran their callbacks with no user context, so this_player() returned 0 and input_to()/printf() were unusable there. Follow the call_out() precedent: capture command_giver (ref-held) when the request is registered and restore it around the callback, skipping destructed objects, gated on the same 'this_player in call_out' setting. The pending-request holders account for the new ref in the DEBUGMALLOC walkers. The new test registers callbacks from two different living objects and asserts each callback sees its own registrant, which fails without the per-request capture. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lv2Gw2AWqtyN3nNEgob1He
1.1 KiB
1.1 KiB
| title |
|---|
| async / async_getdir |
async_getdir
NAME
async_getdir() - returns information pertaining to a filesystem directory
SYNOPSIS
void async_getdir( string dir, function callback );
DESCRIPTION
If 'dir' is a filename ('*' and '?' wildcards are supported), an array
of strings is returned to the callback containing all filenames that match
the specification. If 'dir' is a directory name (ending with a slash--ie:
"/u/", "/adm/", etc), all filenames in that directory are returned.
Unlike the get_dir routine, this efun does not take an integer second
argument to specify more information (filename, filesize, last touched).
The callback should follow this format:
function(mixed res) {
// 0 when directory doesn't exist
// empty array when no matching files exist
// array of matching filenames
}
NOTE
When the 'this_player in call_out' driver setting is enabled,
this_player() inside the callback is preserved from the time the
request was made, like call_out().
SEE ALSO
file_size(3), get_dir(3), stat(3), time(3)