LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

filename with "." as last character

When I use "Write to Text File" with a path ending with "." (e.g. "test.") I get an error at runtime with LV8.20. I have never seen this in older versions and can't think of a good reason why that should create an error.
I know that this is not "good practice" but since ISO-9660 allows any amount of dots in filenames this should not trigger an error. Bug or feature?
-DB
0 Kudos
Message 1 of 6
(2,672 Views)
I think it's more a feature than a bug. You don't specify the operating system, but I assume it's Windows.
If you rename a file with a trailing dot, Windows automatically removes it. This should mean that a name with a trailing dot is illegal in this OS, irrespectively of the ISO rules.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 6
(2,664 Views)

@bef:


I know that this is not "good practice"


If you know that it is not good practice why do you use it?

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 3 of 6
(2,656 Views)
Knowing that something is good or bad practice does not mean:

1. my dumb user knows the good proctice
2. my code knows it.

In my case I have been using a function in an older version of LV where I promt the user for a filename and create 2 files with different "pre-extensions"
(eg: test.dat is converted into test_time.dat and test_fft.dat)
For this I used the OpenG-Strip Extension function, changed the filename-root and appended "." + extension.
Now, if the user chooses fielname=test (w/o extension) my function returns "test_time."

A workaround for this is easy, of course. Bt in older versions that used to work fine. Just another thing to think about when upgrading to LV8.x

And, while I'm at it: When the OS starts fiddling with my filenames it gives me the creeps.
Just imagine you create a file and use the same filename to delete it later. But in the meantime, magic magic, Windows decides to change the name. That's like changing the wheels on your car while driving.
I know, I can still use references...

pincpanter: I forgot to specify the OS. It seems to be a WIN-only problem. on LV8.0 / Linux you can use the dot anywhere.

-DB
0 Kudos
Message 4 of 6
(2,647 Views)


Knowing that something is good or bad practice does not mean:

1. my dumb user knows the good proctice
2. my code knows it.


The dumb user - that's always the hottest topic. In general, you have to design your program in a way, that the dumb user can't do something even dumber (I know that's almost impossible). But regarding a manually entered filename, you could check it and display a message, if the filename was invalid. But anyway - you're the programmer and you're free to do whatever you want - within the program ;).


Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 5 of 6
(2,642 Views)
This reminds me a case when I made similar manipulations on file names. It worked well until the dumb user named a file with two embedded dots instead of one. The funny thing is that the dumb user was... me, trying to create name-versioned data files! Smiley Very Happy
In general, I agree with beckto that the programmer should take the burden to prevent all possible "dumbnesses".
On the other hand, if a given code worked with a LV version, at first one doesn't expect it will be broken in later versions, so I also understand bef's disappointment.

Good G-ob to all members!

Message Edited by pincpanter on 06-26-2007 11:33 AM

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 6
(2,633 Views)