static void module_on_scandir(uv_fs_t *req) { uv_dirent_t dirEntry; char currentPath[512]; size_t size; size = sizeof(currentPath); uv_cwd(currentPath, &size); uv_chdir(req->path); while(uv_fs_scandir_next(req, &dirEntry) != UV_EOF) { const char *extension; if(dirEntry.type != UV_DIRENT_FILE) { continue; } extension = module_get_extension(dirEntry.name); if(extension == NULL || strcmp(module_get_extension(dirEntry.name), "so") != 0) { continue; } module_load(dirEntry.name); } uv_chdir(currentPath); }
int os_chdir(const char *path) { if (p_verbose >= 5) { verbose_enter(); smsg((char_u *)"chdir(%s)", path); verbose_leave(); } return uv_chdir(path); }
static int process_chdir(lua_State *L) { const char *path = luaL_checkstring(L, 1); uv_err_t err = uv_chdir(path); if (err.code != UV_OK) { return luaL_error(L, uv_strerror(err)); } return 0; }
/* Change directory. */ void MVM_dir_chdir(MVMThreadContext *tc, MVMString *dir) { char * const dirstring = MVM_string_utf8_encode_C_string(tc, dir); if (uv_chdir((const char *)dirstring) != 0) { MVM_free(dirstring); MVM_exception_throw_adhoc(tc, "chdir failed: %s", uv_strerror(errno)); } MVM_free(dirstring); }
/* * Class: com_iwebpp_libuvpp_LibUV * Method: _chdir * Signature: (Ljava/lang/String;)V */ extern "C" JNIEXPORT void JNICALL Java_com_iwebpp_libuvpp_LibUV__1chdir (JNIEnv *env, jclass cls, jstring arg) { const char* dir = env->GetStringUTFChars(arg, 0); uv_err_t r = uv_chdir(dir); if (r.code != UV_OK) { ThrowException(env, r.code, "uv_chdir", NULL, dir); } env->ReleaseStringUTFChars(arg, dir); }
static value_t fl_path_cwd(value_t *args, uint32_t nargs) { uv_err_t err; if (nargs > 1) argcount("path.cwd", nargs, 1); if (nargs == 0) { char buf[1024]; err = uv_cwd(buf, sizeof(buf)); if (err.code != UV_OK) lerrorf(IOError, "path.cwd: could not get cwd: %s", uv_strerror(err)); return string_from_cstr(buf); } char *ptr = tostring(args[0], "path.cwd"); err = uv_chdir(ptr); if (err.code != UV_OK) lerrorf(IOError, "path.cwd: could not cd to %s: %s", ptr, uv_strerror(err)); return FL_T; }
static int luv_chdir(lua_State* L) { int ret = uv_chdir(luaL_checkstring(L, 1)); if (ret < 0) return luv_error(L, ret); lua_pushinteger(L, ret); return 1; }