Is there any way to prevent TDMS File Permission changing by 'TDMS Delete Data Function' in LabVIEW

Updated Apr 3, 2024

Reported In

Software

  • LabVIEW

Issue Details

Multiple users log into a testing PC using their Windows credentials to run LabVIEW 2017 for tests.
Test data is saved as TDMS files in the C:\Projects\Logging\Temp folder.
However, the "TDMS Delete Data Function" unintentionally alters file permissions, restricting editing to the current user and admins.
Is there any solution to maintain file permissions while using this function?

Before
螢幕擷取畫面 2024-03-25 113653.png
After
螢幕擷取畫面 2024-03-25 113735.png
VI (Path use: "C:\Projects\Logging\Temp")
螢幕擷取畫面 2024-03-25 113837.png
 

 

Solution

Both TDMS Delete Data and TDMS Defragment create the modified content in a temporary file then move the temporary file over the original.
This has the side effect that the resulting file has default permissions from the temporary directory.

One way to counter this purely in G is to wrap these calls with a VI like below.

  • Copy the file to a temporary file.
  • Do the operation on the temporary copy.
  • Read the file contents from the temporary file.
  • Overwrite the contents of the original file with the contents from the temporary file. Since the file is not deleted, this will maintain the permissions.
  • Delete the temporary file.

螢幕擷取畫面 2024-03-25 120320.png