How to copy files in BlackBox under Linux via Wine?
Posted: Sat Jul 25, 2020 8:29 am
I have the following copy procedure in BlackBox:
This procedure works well, but there is a big difference between Windows and Linux.
In Windows the destination file receives the same modified date as the source file.
In Linux the destination file has a different date. It is the date of the time when the file was copied.
I would like to have the same modified date instead. So I can add the following line to the copy procedure
This does not solve my problem, because in Linux only the owner of the file can change the date of the file.
In the Linux terminal I can copy a file including the last modified date with the command
This works also when I am not the owner of the file. I only need read access of the source and write access to the destination.
How can I do the same command with a BlackBox procedure?
Code: Select all
PROCEDURE Copy* (IN source, destination: ARRAY OF CHAR);
VAR res: INTEGER;
BEGIN
res := WinApi.CopyFileW(source, destination, 0);
IF res # 1 THEN ShowApiError END;
END Copy;
In Windows the destination file receives the same modified date as the source file.
In Linux the destination file has a different date. It is the date of the time when the file was copied.
I would like to have the same modified date instead. So I can add the following line to the copy procedure
Code: Select all
PROCEDURE Copy* (IN source, destination: ARRAY OF CHAR);
VAR res: INTEGER; done: BOOLEAN; t: LONGINT;
BEGIN
res := WinApi.CopyFileW(source, destination, 0);
IF res # 1 THEN ShowApiError END;
done := PacFiles.GetFileTime(source, t);
IF done THEN PacFiles.SetFileTime(destination, t) END;
END Copy;
In the Linux terminal I can copy a file including the last modified date with the command
Code: Select all
cp --preserve=timestamps <source> <destination>
How can I do the same command with a BlackBox procedure?