Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep timestamps of copied assets #1113

Open
sluedecke opened this issue Dec 29, 2022 · 2 comments
Open

Keep timestamps of copied assets #1113

sluedecke opened this issue Dec 29, 2022 · 2 comments

Comments

@sluedecke
Copy link

sluedecke commented Dec 29, 2022

My use case is a static website with quite some assets. The upload mechanism compares file timestamps to check which files have been updated.

Currently assets are copied over to the destination and get a fresh timestamp with each build. Thus my upload mechanism always wants to upload the whole site, even if I have changed only some pages.

So the feature request is for src/cobalt_model/files.rs, where around line 281 fs::copy is used, to also set the timestamp for the target file.

This crate could help: https://crates.io/crates/filetime, esp. the routine filetime::set_file_mtime.

Here is some code which could be used as an example: https://github.com/mtkennerly/ludusavi/blob/e0d16ca4aa6aafad8caebd648c242ac32c2cdae4/src/path.rs#L334

@epage
Copy link
Member

epage commented Dec 29, 2022

mtime is a fairly unreliable way to check to see if something is up-to-date. I'm a bit hesitant to support it for people to use in this way.

@sluedecke
Copy link
Author

Interessting, can you elaborate why you consider mtime unreliable?

Anyways, setting it would still copy the file content to destination and any upload mechanism could decide on how to check for differences. Having an intact mtime would simple add one option to check on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants