--- searchmonkey-0.8.1.old/src/systemio.c +++ searchmonkey-0.8.1/src/systemio.c @@ -996,19 +996,32 @@ } } } else { /* not absolute string, so try best to fix */ - if ((tmpStr[0][0] == '.') && (tmpStr[0][1] == *G_DIR_SEPARATOR_S)) { + int ch = tmpStr[0][0]; + if ((ch == '.') && (tmpStr[0][1] == *G_DIR_SEPARATOR_S)) { g_free(tmpStr[1]); tmpStr[1] = g_strconcat(g_get_current_dir(), &tmpStr[0][2], NULL); if (g_file_test(tmpStr[1], G_FILE_TEST_IS_DIR)) { retStr = strdup(tmpStr[1]); } - } else if ((tmpStr[0][0] == '~') && (tmpStr[0][1] == *G_DIR_SEPARATOR_S)) { + } else if ((ch == '~') && (tmpStr[0][1] == *G_DIR_SEPARATOR_S)) { g_free(tmpStr[1]); tmpStr[1] = g_strconcat(g_get_home_dir(), &tmpStr[0][2], NULL); if (g_file_test(tmpStr[1], G_FILE_TEST_IS_DIR)) { retStr = strdup(tmpStr[1]); } } + else + { + int nn; + char *xp = tmpStr [0]; + nn = strlen (xp); + + if ((nn > 0) && (xp [nn - 1] != '/') && + g_file_test (xp, G_FILE_TEST_IS_DIR)) + { + retStr = strdup (tmpStr [1]); + } + } } /* Clean exit */