Add $^E to your error report and you might get a better idea what is going wrong.
My only guess is that your script is running in a context where it doesn't have a current "working drive" and if you prepend the "C:" to your string, that it might fix the problem.
You can see the code that is producing this error at p5git://win32/win32.c., in particular:
dirp->handle = FindFirstFileW(PerlDir_mapW(wscanname), &wFindData) +; if (dirp->handle == INVALID_HANDLE_VALUE) { DWORD err = GetLastError(); /* FindFirstFile() fails on empty drives! */ switch (err) { case ERROR_FILE_NOT_FOUND: return dirp; case ERROR_NO_MORE_FILES: case ERROR_PATH_NOT_FOUND: errno = ENOENT; break; case ERROR_NOT_ENOUGH_MEMORY: errno = ENOMEM; break; default: errno = EINVAL; break; } Safefree(dirp); return NULL; }
So EINVAL (invalid argument) just means "not ERROR_NO_MORE_FILES, ERROR_PATH_NOT_FOUND, nor ERROR_NOT_ENOUGH_MEMORY". $^E should tell you what GetLastError() returned.
- tye
In reply to Re: Windows folder access error ($^E)
by tye
in thread Windows folder access error
by ArifS
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |