int use_relative_path = 0;
#ifdef TSRM_WIN32
int is_unc;
+ int exists;
#endif
TSRMLS_FETCH();
CWD_STATE_COPY(&old_state, state);
#ifdef TSRM_WIN32
+ exists = (use_realpath != CWD_EXPAND);
ret = 0;
is_unc = 0;
if (path_length >= 2 && path[1] == ':') {
ptr_length = length;
FindClose(hFind);
ret = 0;
- } else if (use_realpath == CWD_REALPATH) {
+ } else {
if (is_unc) {
/* skip share name */
is_unc--;
ret = 0;
} else {
- ret = 1;
+ exists = 0;
+ if (use_realpath == CWD_REALPATH) {
+ ret = 1;
+ }
}
}
}
/* Store existent file in realpath cache. */
#ifdef TSRM_WIN32
- if (use_cache && !is_unc && (use_realpath == CWD_REALPATH)) {
+ if (use_cache && !is_unc && exists) {
#else
if (use_cache && (use_realpath == CWD_REALPATH)) {
#endif