LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

No path or empty path can exist?

Hello!

There is this LV internal VI to check if a file/folder exists, which would return a boolean. When opening the front panel, the path box is empty. When running the VI, see below, it would return TRUE, meaning the not given path exists. That makes me wonder what the definition of the existence of a file or folder is...😮

 

MaSta_1-1678203558328.png

 

 

 

 

 

0 Kudos
Message 1 of 15
(1,894 Views)

The empty path is in LabVIEW indeed a valid path for some functions. 

It is in fact the root to all paths. Under Windows this is the (virtual) path in which all the drives are located. Under Unix this is the root path itself "/".

 

If you use for instance List Folders with an empty path as input you get under Windows all the valid drive letters, and under Unix all the top level directories. Under Mac with HFS you got all the Volumes on the desktop but HFS is not used anymore in LabVIEW for Mac since the demise of the 32-bit version of this with LabVIEW 2017. The 64-bit version of LabVIEW for Mac always used Posix style paths, just as the Linux version.

 

So in summary the Empty Path definitely is a valid path in LabVIEW as it is the root of the file system/desktop.

Rolf Kalbermatter
My Blog
Message 2 of 15
(1,892 Views)

For future reference, you can also find this info in the help file.  And if you think rolfk copied that response from the help file, you would be wrong.  In fact, quite the opposite.  The help file was written based on information in rolfk's brain. 

aputman_0-1678217702924.png

 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 3 of 15
(1,850 Views)

OK, but you would want to use the VI to find out if a file or folder exists, and no path given is not an existing folder, no matter how LV interpret an empty path. At least in this case the LED shouldn't light up. I will modify the VI now. 

0 Kudos
Message 4 of 15
(1,803 Views)

@MaSta wrote:

OK, but you would want to use the VI to find out if a file or folder exists, and no path given is not an existing folder, no matter how LV interpret an empty path. At least in this case the LED shouldn't light up. I will modify the VI now. 


I don't understand this statement.  Wouldn't you just use billko_0-1678284533503.png ?

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 15
(1,781 Views)

If you don't want to allow empty paths, just do a check for them using the comparison function "Is Path and Not Empty?"  The underlying code for the "Check if File/Folder Exists" can't be modified.  That is the "File/Directory Info".  So now you will have one function that returns false and another function that returns true for the same request.  Makes zero sense but you're certainly allowed to do stupid things. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 6 of 15
(1,772 Views)

@aputman wrote:

If you don't want to allow empty paths, just do a check for them using the comparison function "Is Path and Not Empty?"  The underlying code for the "Check if File/Folder Exists" can't be modified.  That is the "File/Directory Info".  So now you will have one function that returns false and another function that returns true for the same request.  Makes zero sense but you're certainly allowed to do stupid things. 


I guess I just never really understood the whole topic because I always make sure that by the time it gets to this point, we aren't looking at an empty path.  Not that it wasn't a valid concern; it was that because of my workflow, it never occurred to me that someone would be trying to do a check with possibly an empty path.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 15
(1,753 Views)

@billko wrote
I guess I just never really understood the whole topic because I always make sure that by the time it gets to this point, we aren't looking at an empty path.  Not that it wasn't a valid concern; it was that because of my workflow, it never occurred to me that someone would be trying to do a check with possibly an empty path.

I agree with you.  I just think it's a stupid decision to modify core LabVIEW code when there are tools to make sure an empty path is avoided. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 8 of 15
(1,741 Views)

@billko wrote:

@MaSta wrote:

OK, but you would want to use the VI to find out if a file or folder exists, and no path given is not an existing folder, no matter how LV interpret an empty path. At least in this case the LED shouldn't light up. I will modify the VI now. 


I don't understand this statement.  Wouldn't you just use billko_0-1678284533503.png ?

 


I think what you want is something like this...

Adjust the last AND input as required.

 

Valide Folder.png

---------------------------------------------
Certified LabVIEW Developer (CLD)
0 Kudos
Message 9 of 15
(1,694 Views)

@Frozen wrote:

@billko wrote:

@MaSta wrote:

OK, but you would want to use the VI to find out if a file or folder exists, and no path given is not an existing folder, no matter how LV interpret an empty path. At least in this case the LED shouldn't light up. I will modify the VI now. 


I don't understand this statement.  Wouldn't you just use billko_0-1678284533503.png ?

 


I think what you want is something like this...

Adjust the last AND input as required.

 

Valide Folder.png


That's pretty much what I would do, except if you look in that Check if File or Folder exists, there already is a File/Directory Info inside and if you do not need the ability to detect files inside LLBs, you might just do this function once. It is not a huge performance killer to call it twice, but he LLB enumeration is and you do not want that function really get called in a tight loop as that for sure can make everything very slow.

Rolf Kalbermatter
My Blog
Message 10 of 15
(1,685 Views)