Sign in to follow this  

FILE_ATTRIBUTE_ARCHIVE - Win32 file attributes

This topic is 4382 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

After getting my resource manager to work, I thought I would change the "search for resource in x folder" code so that it wouldn't look at files it didn't need to ( system files, folders, hidden files, etc. ). Each file can have an attribute of one or more of the following: FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_COMPRESSED FILE_ATTRIBUTE_DIRECTORY FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_HIDDEN FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM FILE_ATTRIBUTE_TEMPORARY So, naturally, I do a check on each file to see if it has the attribute FILE_ATTRIBUTE_NORMAL. My manager immediately stopped finding any of the textures I told it to look for. After much hair pulling and cursing (yay for comparing integers to #defines) I discovered that all my resource files had an attribute of FILE_ATTRIBUTE_ARCHIVE. These are all images I created in GIMP. I am at a loss as to why they are considered archives. Maybe it has to do with the fact that the folder they are in was originally extracted from a zip file ( although, as I stated, the images themselves were created with GIMP ). MSDN's description of FILE_ATTRIBUTE_ARCHIVE is: "The file is an archive file. Applications use this attribute to mark files for backup or removal.", which is, in my opinion, wonderfully vague. I know I've made a check for FILE_ATTRIBUTE_NORMAL in previous code and it worked fine. So my code is working, and I'm not complaining, but I was just curious as to why my files might have this attribute. If any of you could shed some light on this, I would be grateful [smile].

Share this post


Link to post
Share on other sites
FILE_ATTRIBUTE_ARCHIVE doesn't mean the file's a archive. It is (was?) used for backups and it's purpose is to mark a file as "archived" or not (so you know which files has changed since the last backup). If they were extracted from a zip it's possible they are marked as archived. I don't know if this "arhived flag" is used anymore.

Share this post


Link to post
Share on other sites
I've seen drawing programs saving images with Archive attribute (MSPaint, Photoshop, CorelDraw for examples).
I think this is a 'hidden' rule between programmers, as Microsoft said Archive files are ready for archiving (in Windows NT there is a built in utility - I don't remember the name - automatically compresses Archive files and delete unnecessary stuff). Images is probably considered safe to compress.

Share this post


Link to post
Share on other sites
The archive attribute is not particularely useful nowadays. Basically in old days once a file was backupped its archive flag was removed. Once the file was modified it got the archive flag set marking it as need-to-backup.

I'd rather go the exclusive approach and ignore all files with the unwanted attributes like system file/folder or others.

Share this post


Link to post
Share on other sites
Quote:
Original post by __filip
FILE_ATTRIBUTE_ARCHIVE doesn't mean the file's a archive. It is (was?) used for backups and it's purpose is to mark a file as "archived" or not (so you know which files has changed since the last backup). If they were extracted from a zip it's possible they are marked as archived.


Yeah, I know the file isn't actually an archive - that's the weird part.

I also realized that a file I am writing using my resource manager is marked with FILE_ATTRIBUTE_ARCHIVE.

Its just strange that I've done this before and never ran into this problem.

Quote:
I don't know if this "arhived flag" is used anymore.


That is possible, especially considering the amount of backward-compatibility code in the windows API.

Thanks for the reply.

Share this post


Link to post
Share on other sites
Quote:
Original post by Endurion
The archive attribute is not particularely useful nowadays. Basically in old days once a file was backupped its archive flag was removed. Once the file was modified it got the archive flag set marking it as need-to-backup.

I'd rather go the exclusive approach and ignore all files with the unwanted attributes like system file/folder or others.


Ah, that clears it up a bit. Thanks!

@Skeleton_V@T: That makes sense.

Now I know to be aware of this in the future. Thanks for all the replies.

Share this post


Link to post
Share on other sites

This topic is 4382 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this