09-30-2008 08:43 AM
I usually specify path name expressions with double backslashes to avoid problems when a backslash is followed by a character interpreted as an escape sequence (e.g. C:\test, where \t would be the Escape sequence for a TAB).
Now I tried to execute a sequence on a remote computer. The sequence was specified in an expression string as "D:\\TestStand\\Sequences\\Test.seq" and I got the message that the sequence file could not be found on the remote computer. Using the expression string "D:\TestStand\Sequences\Test.seq" worked fine.
What is the safest way to handle strings with path expressions in TestStand consistently?
Regards
Peter
10-01-2008 08:03 AM
Hi Peter,
you can read the path with e.g. Messagepopup/Statement in expression tab: Runstate.SequenceFile.Path and then put a second backslash to the absolute path in most case. In other case e.g. SQL steps it can be only one backslash.
What you describe is that some applications like Teststand use intern double backslash but when you give the path to other tools that it can be that you only should use one backlash. So e.g. Somtimes you write "c:\\test\file1.seq", sometimes " "c:\test\file1.seq" " or sometimes c:\\test\\file1.seq or sometimes ' " c:\test\file.seq" ' as an example of sql command with teststand...
Do you understand what i mean ? Look in following link:
http://en.wikipedia.org/wiki/Path_(computing)
Best Regards
Johann
10-01-2008 08:58 AM
Hi Johann,
thank you. Problem is that it is not necessarily the path of my current sequence file, but some path that I build in an expression. So I do not have a source generated by TestStand which should always work.
As far as I understand the documentation, "C:\test" would expand to "C: est" (the spaces representing a tab), "C:\Test" would remain as is, "C:\\test" would expand - or rather shrink - to "C:\test".
So for safety, I would always build paths with double backslashes, but that does not work with the Remote Engine (i.e., not a different tool, but a part of TestStand itself).
So the question is, can I rely on a single backslash to be treated correctly in a path name and not expand into an Escape sequence? Or can, possibly, the remote engine work with forward slashes in paths?
Best regards,
Peter
10-01-2008 09:23 AM
So the general solution will be when you work remote then use one backslash and when not with two backslashes.
Unfortunatelly no other solutions with using one expression for all...
Best Regards
10-02-2008 08:10 AM
In sequence calls you can specify the sequence file with a path or with a path expression. If you use a path expression, it should contain surrounding quotes and double backslashes (e.g. "D:\\Test\\MyFile.seq"). If you use a path, it shouldn't (e.g. D:\Test\MyFile.seq). This is true whether or not you are using the "Use Remote Computer" sequence call option.
If you use a string variable for the path expression (e.g. Locals.sequenceFilePath), then the variable should contain the path without the double backslashes and surrounding quotes. Only string literals need to have the double backslashes.
10-02-2008 09:18 AM
Thanks to all. I will test the suggestions and, if need be, post again.
Best regards,
Peter