poco icon indicating copy to clipboard operation
poco copied to clipboard

File::exists() wrong result

Open micheleselea opened this issue 7 years ago • 4 comments

Expected behavior

if the file does not exists return false, true if exists

Actual behavior

Sometimes happens to me that for some network files (accessed like \IP\folder\file.txt) function seems to return false even if the file exists. I think the problem is (under windows) the function existsImpl() return false if ERROR_NOT_READY. I have to investigate more on that. If happens the NOT READY could be not permanent but temporary situation

POCO version

1.9.0

Compiler and version

Visual studio 2015

Operating system and version

Window 10

Other relevant information

using network drive with network uri

I don't know if it's better to leave the ERROR_NOT_READY out switch

micheleselea avatar Jul 25 '18 07:07 micheleselea

Strictly speaking, that falls into a "grey zone" of network share existing, file possibly being there, but we can't tell one way or the other - exceptional circumstances. One could also argue that, for practical purposes, at the time of function call the file exists or not equally as any file at any unaccessible location. But, yes - exception would provide more accurate information than returning false.

aleks-f avatar Jul 25 '18 13:07 aleks-f

the problem is that you could create a new file, clearing existing one, because you get false or you could leave a file that you must delete but you think is not there. anyway you are right it's some kind of grey zone

micheleselea avatar Jul 25 '18 14:07 micheleselea

I say, move it to exception. @obiltschnig

aleks-f avatar Aug 01 '18 22:08 aleks-f

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Jun 26 '22 03:06 github-actions[bot]

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Nov 27 '23 02:11 github-actions[bot]