Skip to content

Commit

Permalink
[api] Added os.abspath() function
Browse files Browse the repository at this point in the history
  • Loading branch information
pajama-coder committed May 22, 2024
1 parent 195a687 commit 4a0548e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/api/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ template<> void ClassDef<OS>::init() {
ret.set(OS::home());
});

// os.abspath
method("abspath", [](Context &ctx, Object*, Value &ret) {
Str *pathname;
if (!ctx.arguments(1, &pathname)) return;
ret.set(fs::abs_path(pathname->str()));
});

// os.stat
method("stat", [](Context &ctx, Object*, Value &ret) {
Str *filename;
Expand Down

0 comments on commit 4a0548e

Please sign in to comment.