forked from enlightenment/efl
ecore_file_can_exec: fix .bat case
the test on the .bat file was too early Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br> Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D12122
This commit is contained in:
parent
b89f1cc0a3
commit
2261332969
|
@ -643,7 +643,7 @@ ecore_file_can_exec(const char *file)
|
||||||
h = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL,
|
h = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||||
if (h == INVALID_HANDLE_VALUE)
|
if (h == INVALID_HANDLE_VALUE)
|
||||||
return EINA_FALSE;
|
goto test_bat;
|
||||||
|
|
||||||
if (!GetFileSizeEx(h, &sz))
|
if (!GetFileSizeEx(h, &sz))
|
||||||
goto close_h;
|
goto close_h;
|
||||||
|
@ -697,16 +697,16 @@ ecore_file_can_exec(const char *file)
|
||||||
*/
|
*/
|
||||||
if ((characteristics & 0x0002) && !(characteristics & 0x2000))
|
if ((characteristics & 0x0002) && !(characteristics & 0x2000))
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
unmap_view:
|
||||||
|
UnmapViewOfFile(base);
|
||||||
|
close_h:
|
||||||
|
CloseHandle(h);
|
||||||
|
test_bat:
|
||||||
/*
|
/*
|
||||||
* a .bat file, considered as an executable, is only a text file,
|
* a .bat file, considered as an executable, is only a text file,
|
||||||
* so we rely on the extension. Not the best but we cannot do more.
|
* so we rely on the extension. Not the best but we cannot do more.
|
||||||
*/
|
*/
|
||||||
return eina_str_has_extension(file, ".bat");
|
return eina_str_has_extension(file, ".bat");
|
||||||
unmap_view:
|
|
||||||
UnmapViewOfFile(base);
|
|
||||||
close_h:
|
|
||||||
CloseHandle(h);
|
|
||||||
#else
|
#else
|
||||||
if (!access(file, X_OK)) return EINA_TRUE;
|
if (!access(file, X_OK)) return EINA_TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue