Set the archive flag on file changes

This commit is contained in:
Sparchatus 2022-05-31 10:02:11 +00:00
parent 5843870c1d
commit 6d6c3b226f

View File

@ -1353,7 +1353,7 @@ static errval_t _fat32_fcreate(struct fat32 *fat32, const char *path, struct fat
// store the directory in the space in the parent directory we found
assert(free_cluster_number > 1);
struct fat32_directory_entry directory_entry = {
.attributes = 0,
.attributes = FAT32_ATTR_ARCHIVE, // mark the file for backup utilities
.first_cluster_number_low_word = fat32_cluster_number_low_word(free_cluster_number),
.first_cluster_number_high_word = fat32_cluster_number_high_word(free_cluster_number),
.file_size = 0,
@ -1593,6 +1593,10 @@ static errval_t _fat32_fwrite(struct fat32 *fat32, struct fat32_handle *file_han
fat32_get_time_information(&write_date, &write_time);
directory_entry.write_date = write_date;
directory_entry.write_time = write_time;
// set the archive flag
directory_entry.attributes |= FAT32_ATTR_ARCHIVE;
errval_t dir_update_err = fat32_write_directory_entry(
fat32,
file_handle->directory_entry_ref,