Kouhei Sutou 2019-05-11 17:34:05 +0900 (Sat, 11 May 2019) Revision: ac466598fa2ca1f2e739812d0b2d7e8d9f11a2ba https://github.com/groonga/groonga/commit/ac466598fa2ca1f2e739812d0b2d7e8d9f11a2ba Message: plugin_unregister: add support for Windows path (maybe...) Modified files: lib/plugin.c Modified: lib/plugin.c (+19 -1) =================================================================== --- lib/plugin.c 2019-05-10 19:11:29 +0900 (10fb6589d) +++ lib/plugin.c 2019-05-11 17:34:05 +0900 (4fc8258b9) @@ -828,6 +828,24 @@ exit : return found_path; } +static bool +grn_plugin_find_path_is_absolute_path(grn_ctx *ctx, const char *name) +{ + /* UNIX */ + if (name[0] == '/') { + return true; + } + + /* Windows */ + if ((('a' <= name[0] <= 'z') || ('A' <= name[0] <= 'Z')) && + name[1] == ':' && + name[2] == '/') { + return true; + } + + return false; +} + char * grn_plugin_find_path(grn_ctx *ctx, const char *name) { @@ -835,7 +853,7 @@ grn_plugin_find_path(grn_ctx *ctx, const char *name) GRN_API_ENTER; - if (name[0] == '/') { + if (grn_plugin_find_path_is_absolute_path(ctx, name)) { found_path = grn_plugin_find_path_one(ctx, name); } else { GRN_PLUGINS_DIR_EACH_BEGIN(dir, dir_length) { -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190511/1f756a9e/attachment.html>