/* * call-seq: * fis.create_index(dir) -> self * * Create a new index in the directory specified. The directory +dir+ can * either be a string path representing a directory on the file-system or an * actual directory object. Care should be taken when using this method. Any * existing index (or other files for that matter) will be deleted from the * directory and overwritten by the new index. */ static VALUE frb_fis_create_index(VALUE self, VALUE rdir) { FieldInfos *fis = (FieldInfos *)DATA_PTR(self); Store *store = NULL; if (TYPE(rdir) == T_DATA) { store = DATA_PTR(rdir); REF(store); } else { StringValue(rdir); frb_create_dir(rdir); store = open_fs_store(rs2s(rdir)); } index_create(store, fis); store_deref(store); return self; }