开发者

Convert Unix Style Path to Windows (or OS-specific) path in LABVIEW

I am using labview 8.5.1

I have the path to a file stored as a unix-style开发者_JAVA技巧 string in a text file. (e.g. the file contains the string /refs/heads/master )

I would like to convert this to a path in LABVIEW, but the string-to-path function assumes that I have a windows style path string (e.g. \refs\heads\master )

The specific context in which this comes up is I want to log a git hash code with collected data so I will always know the specific version of the software I am using, and git stores files as unix-style-strings.

A quick solution is to find&change all / to \, but this is inelegant & also will cause the VI to crash if it is ever run on OSX or any other OS that uses unix style formatting.

Is there a way to force the string-to-path VI to use a specific OS style?

(suggested tag: path-formatting)


You can convert the string to an array of strings (by using the / as delimiter) and convert the resulting array into a LabVIEW Path datatype (which internally is an array of strings):

Convert Unix Style Path to Windows (or OS-specific) path in LABVIEW

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜