LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Key and Write Key not working as expected with paths on RT

The configuration file VIs Read Key (Path) and Write Key (Path) don't seem to work as expected (at least not as I was expecting them to) on an RT target.

When working on my WinXP PC with these two VIs, paths are translated to what looks like is supposed to be a device-independent format before being written to disk. The path C:\dir\file.txt becomes /C/dir/file.txt when writing and vice versa when reading. On my RT target, however, that same path is written to disk as C:\dir\file.txt, unchanged from the native format.

The translaton of a native path to and from the device-independent format appears to be the responsibility of Specific Path to Common Path and Common Path to Specific Path. These both use the App.TargetOS property to determine the operating system. In the case structure for these two VIs, however, there is no case for PharLap or RTX. (My RT hardware is runnng PharLap; I don't know enough about RTX to comment.) This means that the results of String to Path or Path to String are used without translating between the device-independent format to the native path format.

This isn't a problem if you create a configuration file on one machine and use it on that same machine. I noticed this only when tranferring a config file from my PC to the RT target, where the target would not open the file paths it loaded from the configuration file.

This occurs on 7.1.1 and 8.0.  I don't have 8.20 to see if happens there, too.

0 Kudos
Message 1 of 2
(3,470 Views)
In LV 8.2, this was fixed.

The problem is App.TargetOS returns "Pharlap" on RT systems, and "Pharlap" is handled by the default case ("invalid OS target") in LV 8.0.  In LV 8.2 the default case is "Windows 95/NT", however.  The reason you could write and read an .ini file on RT in LV 8.0 and earlier is because these two VIs (listed below) were both running the default case of "invalid OS target".

vi.lib\Utility\config.llb\Common Path to Specific Path.vi
vi.lib\Utility\config.llb\Specific Path to Common Path.vi

As you saw, this fails when you perform one operation in Pharlap but the other in Windows.  You can fix this by modifying the two VIs listed above.  Just go to the case structure and make "Windows 95/NT" the default case.
Message 2 of 2
(3,420 Views)