This content has been marked as final. Show 3 replies
Jay, LrFileUtils.exists will return "directory" or "file" depending on what it finds at the path you provide. I think this should provide the info you're seeking.
Doh! :-) Indeed it does. I must confess I saw the method in the summary but never even read it's description, assuming that it would just return a true/false and wasn't useful for what I was doing.
I've just tried a few examples with it. It mostly works as I expect, with one exception, which you may very will find to be nitpicky. I've found that Lr is usually happy regardless of whether I use "/" or "\" as a separator (on Windows, at least), except that "//foo" and "//foo/bar" return false even though "\\foo" and "\\foo\bar" return true. "//foo/bar/baz" works fine. I really have no clue if this is an Lr quirk or a Windows quirk.
Regardless, I'm satisfied and moving along. Thanks Eric!
I created a utility wrapper around this method and basically call
isFile, isDirectory which return true if it exists and is file/directory and false insteand.
I also thought LrFileUtils.exists is rather confusing coz it returns two different types, false or string.
I would rather have a wrapper around it like
doesFileExist and doesDirectory exist, since then, my life is much easier. :-)