Jump to content

Minor quibble: I think the "File Exists" primitive should return FALSE on empty path input.


Recommended Posts

Perhaps my definition of "exists" is subtly different than the typical OpenG developer/user, but I had the expectation that an empty path input would return false.

I find that in most situations where I want to check if a path exists, I'm about to perform a file operation that also requires that path to be non-empty.

I don't think I'd ever use the "File Exists" primitive without also calling the "Empty Path/String?" primitive.

Edited by Mike Le
Link to comment
Perhaps my definition of "exists" is subtly different than the typical OpenG developer/user, but I had the expectation that an empty path input would return false.

I find that in most situations where I want to check if a path exists, I'm about to perform a file operation that also requires that path to be non-empty.

I don't think I'd ever use the "File Exists" primitive without also calling the "Empty Path/String?" primitive.

 

Empty path is actually not empty on Linux, it's "/" or the root directory.  On Windows and Mac, if you list the contents of empty path, it lists all the drives on the computer.  So, this isn't really an OpenG definition, as much as it is a LabVIEW definition.

 

I hope that helps.

Link to comment

I had a similar complaint (without knowing the platform issues) so I have made a small VI that is called "Is Path Valid and Exists?" which uses the two OpenG VIs "File Exists" and "Valid Path".  I never just use the "Valid Path" anymore.  You could do something similar where it needs to be "Valid Path", and Not "Empty String/Path"

Link to comment

Thanks for the background info, Jim.

 

 

I had a similar complaint (without knowing the platform issues) so I have made a small VI that is called "Is Path Valid and Exists?" which uses the two OpenG VIs "File Exists" and "Valid Path".  I never just use the "Valid Path" anymore.  You could do something similar where it needs to be "Valid Path", and Not "Empty String/Path"

 

Yes, this is exactly what I'll be doing. Thanks.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.