mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 12:02:53 +02:00
add system.file_exist? (#19)
binding to the internal filesystem.exists, a less janky way of checking if a file exists in the path cache
This commit is contained in:
parent
7dd50c8546
commit
0a28d4cf3c
1 changed files with 14 additions and 0 deletions
|
@ -133,6 +133,7 @@ RB_METHOD(mkxpSystemMemory);
|
|||
RB_METHOD(mkxpReloadPathCache);
|
||||
RB_METHOD(mkxpAddPath);
|
||||
RB_METHOD(mkxpRemovePath);
|
||||
RB_METHOD(mkxpFileExists);
|
||||
RB_METHOD(mkxpLaunch);
|
||||
|
||||
RB_METHOD(mkxpGetJSONSetting);
|
||||
|
@ -243,6 +244,7 @@ static void mriBindingInit() {
|
|||
_rb_define_module_function(mod, "reload_cache", mkxpReloadPathCache);
|
||||
_rb_define_module_function(mod, "mount", mkxpAddPath);
|
||||
_rb_define_module_function(mod, "unmount", mkxpRemovePath);
|
||||
_rb_define_module_function(mod, "file_exist?", mkxpFileExists);
|
||||
_rb_define_module_function(mod, "launch", mkxpLaunch);
|
||||
|
||||
_rb_define_module_function(mod, "default_font_family=", mkxpSetDefaultFontFamily);
|
||||
|
@ -574,6 +576,18 @@ RB_METHOD(mkxpRemovePath) {
|
|||
return path;
|
||||
}
|
||||
|
||||
RB_METHOD(mkxpFileExists) {
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
VALUE path;
|
||||
rb_scan_args(argc, argv, "1", &path);
|
||||
SafeStringValue(path);
|
||||
|
||||
if (shState->fileSystem().exists(RSTRING_PTR(path)))
|
||||
return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
RB_METHOD(mkxpSetDefaultFontFamily) {
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue