Sunday, 15 April 2012

.net - File.GetAttributes syntax -



.net - File.GetAttributes syntax -

i trying debug application i'm not familiar with.

somewhere in code, see :

file.getattributes(filename) _ .equals(fileattributes.archive | fileattributes.readonly)

what fileattributes.archive | fileattributes.readonly (with single pipe) tests ? guessed see if file either archived or readonly, file archived, , test returns false.

thanks

that code flat-out wrong. whoever wrote messed around until got working. fileattributes enum type has [flags] attribute. means combination of flags can set. or operator does, combines both archive , readonly attributes.

which works accident, file has archive attribute turned on. code fail miserably 1 time user backs-up file. turns off archive attribute , equals() method no longer works, though file still readonly.

you must prepare bug. create instead:

if (file.getattributes(filename) , fileattributes.readonly) = fileattributes.readonly '' read-only ''... end if

.net file-io

No comments:

Post a Comment