[sword-devel] Confusing semantics for FileMgr::existsFile() and FileMgr::existsDir()

Jaak Ristioja jaak at ristioja.ee
Fri Oct 21 12:56:25 MST 2016


Hi!

In reality, the FileMgr::existsFile() and FileMgr::existsDir() static
methods not only check whether a file exists (or is visible to the
calling process), but also whether the given file is readable, because
internally, it uses the ::access system call with mode set to 04 which
is R_OK. Whereas it would suffice to use F_OK to check for existance.

What should the correct semantics and function names be?

Blessings,
J

PS: Semantically, these two functions seem to duplicate one another,
except for memory requirements.



More information about the sword-devel mailing list