//## boolean System.mkdir(String path, int mode) static KMETHOD System_mkdir(KonohaContext *kctx, KonohaStack *sfp) { KMakeTrace(trace, sfp); char buffer[K_PATHMAX]; kString *path = sfp[1].asString; const char *systemPath = PLATAPI I18NModule.formatSystemPath(kctx, buffer, sizeof(buffer), kString_text(path), kString_size(path), trace); mode_t mode = (mode_t)sfp[2].intValue; int ret = mkdir(systemPath, mode); if(ret == -1) { KTraceErrorPoint(trace, SystemFault, "mkdir", LogFileName(kString_text(path)), LogMode(mode), LogErrno); } else { KTraceChangeSystemPoint(trace, "mkdir", LogFileName(kString_text(path)), LogMode(mode)); } KReturnUnboxValue(ret != -1); }
// boolean System.access(String path, int mode); static KMETHOD System_access(KonohaContext *kctx, KonohaStack *sfp) { KMakeTrace(trace, sfp); char buffer[K_PATHMAX]; kString *path = sfp[1].asString; const char *systemPath = PLATAPI formatSystemPath(kctx, buffer, sizeof(buffer), S_text(path), S_size(path), trace); mode_t mode = (mode_t)sfp[2].intValue; int ret = access(systemPath, mode); if(ret == -1) { KTraceErrorPoint(trace, SystemFault, "access", LogFileName(S_text(path)), LogMode(mode), LogErrno); } KReturnUnboxValue(ret != -1); }