LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
manu.NET

"Check if file or folder exists" VI should not return TRUE for an empty path !

Status: New

Hello,

 

The "Check if file or folder exists" VI returns "TRUE" if you wire an empty path as input.

According to me, the VI should return false for an empty path.

 

I think this behavior is very dangerous !

 

An empty path is interpreted by Labview (Or Windows directly) as the main root C:\.

So the empty path always exists ... but ... is it really what the user wants ?

I think that this default empty value should be replaced by the root directory.

 

23814i58F78D115487B939

 

Manu.

 

 

Manu.net
3 Comments
PhillipBrooks
Active Participant

From the function help:

 

If you wire an empty path to path, file or folder exists? returns TRUE because the empty path refers to the list of drives mapped to the computer. (Mac OS) The empty path refers to the mounted volumes. (Linux) The empty path refers to the root directory.

 

LabVIEW has a specific constant called "Not a Path".

 

From the constant help:

 

Unlike the empty path constant, this constant is an invalid path, and is generally returned when a path operation fails.

 

The behavior is documented, and there is a comparison function named "Not a Number/Path/Refnum?" that you can test for 'Not a Path".

 

 


@manu.NET wrote:
According to me, the VI should return false for an empty path.

YOU may not like the behavior, but it is documented, and changes to the behavior would affect everyone else...

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

manu.NET
Active Participant

Hello Phillip,

 

I know these constants and i use them i my programs ...

 

Perhaps the idea should be modified this way ...

 

In fact my problem is about the result of the "path control". Perhaps the idea should be ...

 

The path control should not return an "empty path" if nothing has been selected. The control should return "not a path" instead !

 

Manu.

 

 

Manu.net
TroyK
Active Participant

I agree with Manu and Phillip Smiley Happy with one modification. Add an option to "Treat empty path as FALSE", maybe modify the icon when it's in the alternate mode.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument