Preserve original file timestamp on packaging
Answered
We have an Adobe AIR Actionscript project in IntelliJ IDEA.
When packaging the AIR application, we'd like the files copied from the source to keep their original timestamps, rather than all files being marked as created / modified at the time of packaging. Is there a way to achieve that?
According to our tests, we experienced mixed results, with one IntelliJ IDEA instance (Ultimate 2022.3.3) preserving the original timestamps, and another (Ultimate 2022.3.2) setting all timestamps to the time of packaging.
Please sign in to leave a comment.
Hi Denis Rionnet Could you clarify how do you build the project? Do you use any build system like Maven, Gradle?
Please share a screenshot from File | Project Structure | Artifacts | your_artifact_configuration | Packaging
If possible please share a small project sample reproducing the issue. The files can be uploaded at https://uploads.jetbrains.com (do not forget to specify the UploadID here)
Thank you!
Hi Egor Klepikov, thanks for your help!
We use Build > Package AIR Application... No Maven, Gradle...
This 'Artifacts' section is totally empty.
I'll make a smaller sample project to try & reproduce the issue, and will upload it.
I've just made a sample project from scratch, but the source files' timestamps ARE actually preserved in the output folder, so...
Going to look further for my actual project...
So far, I haven't been able to reproduce the issue with the sample project.
In my actual project, the issue is a bit random.
Below is a directory, as seen in the source folder (left), and in the output folder (right). All output files have a creation date set to the time of packaging (13/06/2023 18:24), but most files keep the original modification date (second column), except one (highlighted, 11th line) whose modification date is also set according to the packaging time.
For another directory in the same project, all output files (right) get marked with the time of packaging, both creation & modification date:
Thank you for the additional information. To verify whether the problem comes from the IDE or it is some project misconfiguration please check if it works in the same way if you build the application from the command line outside of the IDE
Thank you for your help. We're not quite familiar with the command line, since we've always used the IDE for that (IntelliJ, and previously FlashBuilder). With command line: many options & parameters... so many technical reasons for the process to fail...
What I can add so far:
I'd like try to reproduce this problem from our side. Could you provide a screenshot from `Build | Package AIR Application` dialog? For now, I'm not sure the problem is directly related to IntelliJ IDEA as I don't see similar reports from our Flash/Adobe AIR users
Do you see the same problem when the project is built via FlashBuilder?
Here is the screenshot:
A specificity of our project is that we merge several assets folders into one.
I finally managed to reproduce the issue in my sample project. (First time I checked, I think it didn't have the issue, so either I didn't check properly, or something happened inbetween.) Here it is:
Upload id: 2023_06_20_RRvVWYk7mMSpadvndBmYxr (file: DateTest.zip)
It has a similar architecture (just much smaller and simpler), in that it merges 2 assets folders into one.
Here are some screenshots of the assets folders:
Source assets, folder #1:
File dates are years old (except for the creation date).
Source assets, folder #2:
File dates are years old (except for the creation date).
Output assets, merged folder:
The "Date" & "Modification date" are correct.
Output, target directory where the final bundle is packaged, along with the executable file, the "Adobe AIR" and "META-INF" directories:
All dates are set to the time of packaging.
I'm not sure if my project structure is 100% correct...? It works, but maybe it's not optimal?
Anyway, as I said, if nothing else works, we might use the first output directory to retrieve merged assets, rather than the packaged directory.
I haven't explained so far: the global idea is to put the packaged files to a remote server and have them synchronized to the users' device (Windows), rather than having users download the whole application every time it gets updated (since the project has a huge global file size). But of course, for this scheme to work, we need the file timestamps to be preserved all along the process:
Source => Packaging => Upload to server => Download from server => Write to user disk
Hi,
The mentioned behavior could be reproduced from our side, unfortunately, AIR-related fixes in IntelliJ IDEA are currently only done for major/security matters due to its popularity. Technically, the Flex / AIR plugin is open-source and we are ready to review pull requests https://github.com/JetBrains/intellij-plugins/tree/master/flex so we would gladly review it if you found a fix.
As of now, our only recommendation would be to apply the workaround you mentioned and use the first output directory to retrieve merged assets, rather than the packaged directory.
Thank you for understanding.