Skip to content

Commit

Permalink
Set path for directory object
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan63 committed Dec 6, 2023
1 parent 9dd75bd commit 23a3fe2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions include/hx/asys/Asys.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ namespace hx
class Directory_obj : public Object
{
public:
const String path;

Directory_obj(String _path) : path(_path) {}

static void open(Context ctx, String path, Dynamic cbSuccess, Dynamic cbFailure);
static void create(Context ctx, String path, int permissions, bool recursive, Dynamic cbSuccess, Dynamic cbFailure);
static void move(Context ctx, String oldPath, String newPath, Dynamic cbSuccess, Dynamic cbFailure);
Expand Down
6 changes: 3 additions & 3 deletions src/hx/libs/asys/libuv/filesystem/LibuvDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ namespace
uv_loop_t* loop;
uv_dir_t* dir;

LibuvDirectory_obj(uv_loop_t* _loop, uv_dir_t* _dir)
: loop(_loop), dir(_dir) {}
LibuvDirectory_obj(uv_loop_t* _loop, uv_dir_t* _dir, String _path)
: Directory_obj(_path), loop(_loop), dir(_dir) {}

void next(const int batch, Dynamic cbSuccess, Dynamic cbFailure)
{
Expand Down Expand Up @@ -143,7 +143,7 @@ void hx::asys::filesystem::Directory_obj::open(Context ctx, String path, Dynamic
}
else
{
Dynamic(spData->cbSuccess.rooted)(Directory(new LibuvDirectory_obj(spRequest->loop, static_cast<uv_dir_t*>(spRequest->ptr))));
Dynamic(spData->cbSuccess.rooted)(Directory(new LibuvDirectory_obj(spRequest->loop, static_cast<uv_dir_t*>(spRequest->ptr), String::create(spRequest->path))));
}
};

Expand Down

0 comments on commit 23a3fe2

Please sign in to comment.