mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 21:10:19 +00:00
...
This commit is contained in:
parent
6031bf4799
commit
46b1b1b900
@ -38,3 +38,7 @@ Joins the given paths together.
|
|||||||
### `os.path.exists(path: str)`
|
### `os.path.exists(path: str)`
|
||||||
|
|
||||||
Check if the given path exists.
|
Check if the given path exists.
|
||||||
|
|
||||||
|
### `os.path.basename(path: str)`
|
||||||
|
|
||||||
|
Returns the basename of the given path.
|
5
src/io.h
5
src/io.h
@ -169,6 +169,11 @@ inline void add_module_os(VM* vm){
|
|||||||
bool exists = std::filesystem::exists(path);
|
bool exists = std::filesystem::exists(path);
|
||||||
return VAR(exists);
|
return VAR(exists);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
vm->bind_func<1>(path_obj, "basename", [](VM* vm, ArgsView args){
|
||||||
|
std::filesystem::path path(CAST(Str&, args[0]).sv());
|
||||||
|
return VAR(path.filename().string());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace pkpy
|
} // namespace pkpy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user