glob.c無法識別的應用程序目錄的目錄:如何使Android的glob.c工作?
const char* cpath = env->GetStringUTFChars(jpath, 0);
debug("testing converting for [%s]", cpath);
//
const char *patnext = cpath;
size_t limit;
wchar_t *bufnext, *bufend, patbuf[MAXPATHLEN];
mbstate_t mbs;
wchar_t wc;
size_t clen;
bufnext = patbuf;
bufend = bufnext + MAXPATHLEN - 1;
int len = 0;
while (bufend - bufnext >= MB_CUR_MAX) {
clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs);
debug("clen = %i", clen);
if (clen == (size_t)-1 || clen == (size_t)-2) {
env->ReleaseStringUTFChars(jpath, cpath);
return JNI_FALSE;
}
else if (clen == 0)
break;
*bufnext++ = wc;
patnext += clen;
len += clen;
}
for (int i=0; i<len; i++) {
debug("%c", patbuf[i]);
}
glob((const char *)patbuf, GLOB_MARK, NULL, &glob_results);
debug("glob returned %i\n", glob_results.gl_pathc);
返回0,但1的預期。在Github上
03-03 23:58:30.274: ERROR/NATIVE_LIB(3506):/
03-03 23:58:30.274: ERROR/NATIVE_LIB(3506): d
03-03 23:58:30.274: ERROR/NATIVE_LIB(3506): a
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): t
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): a
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506):/
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): d
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): a
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): t
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): a
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506):/
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): c
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): o
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): m
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): .
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): e
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): x
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): a
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): m
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): p
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): l
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): e
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): .
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): W
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): i
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): d
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): e
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): C
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): h
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): a
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): r
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): D
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): e
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): m
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): o
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506):/
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): f
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): i
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): l
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): e
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): s
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506):/
03-03 23:58:30.284: ERROR/NATIVE_LIB(3506): glob returned 0
測試項目:https://github.com/4ntoine/WideCharDemo
怎樣纔可以解決嗎?任何走動?
你從哪裏找到glob.c和glob.h?你提到的github路徑不再存在。你解決了你的問題嗎? –