Closed goofinator closed 4 years ago
I have a question. If i try to get FileList and one of the files opening fails. What is the best way to process it? let's say: file1.txt nofile2.txt file3.txt I'm processing it. open file1.txt - success. open nofile2.txt - failure. I break the cycle with error immediately? if yes, should i close file1.txt? I think both - yes.
That’s a good question. Generally I think yes to both would be a good approach. Though it may not fit every use case, but would probably be fine to do just that.
For graceful closure of files - if we didn’t touch them it won’t be necessary as it won’t affect files anyhow. It only would become an issue if files were open for writing and the application wrote some bytes to it. So while is a good practice - may not be such a strict requirement I think.
If we go deeper (dicaprio.jpg) ... the situation of using several File / FileList arguments is unpleasant. If one of them fails to open, we get set of opened and not opened files. Of course, this will be a problem only if the program does not exit.
sorry about 66f217e and c4cc2e4. Didn't noticed how switched to the main branch.
Hello! Added typed lists. One type and tests for it per commit. List now called from the StringList