When rethrowing an exception, we should do it by simply calling throw;
and not throw exc;, because the stack trace is reset with the second
syntax, making debugging a lot harder.
After we removed the tilde expansion in revision c9aa6cf5fb ("Avoid
performing tilde expansion"), the Utility.ExpandEnvironmentVariables
method simply called System.Environment.ExpandEnvironmentVariables. We
can simplify the code by just referencing the built-in method directly.
This is done by renaming the second file (or first if only one file is being created) and updating the in memory set of expected files,
while keeping track of the original info so it can be reported if it is still present (e.g., if the rename operated as a copy instead).
Without this, the auto create folders flag was broken for backends which lazily enumerate List() (as they instead throw after the try block is ended)
Calling Test() dierctly also better matches the IBackend interface contract.
By changing to IEnumerable, it is possible to iterate only a portion of the list, which is useful when not all entries are needed (e.g., when testing a connection).
All existing backends have been updated, and any which were able to be changed to yield return results in a straightforward way now do.
Many backends had a try/catch in the List() method. Due to the fact that yield returns can't be placed within a try/catch block, these have been refactored to either scope the try/catch to the parts that (should) be the only places throwing exceptions, so that exceptions are still caught and handled.
Note that lazy evaluation may cause some changes in behavior - exceptions that were previously thrown at the point of invokation of List() may now be thrown while it is being enumerated.
I believe this will not be problematic though, as the only well-known exception seems to be FolderMissingException, which should be thrown by Test(), but TestList() attempts to enumerate the list to force this exception.
Any places that require the legacy behavior can get it by simply converting the lazy enumerable to a List()
Added a current pointer-file to allow running with a version that is not the newest.
Updater is now working except for OSX, where the bundle setup is causing issues when running the loaded instance.
Still needs a work over in terms of error handling, progress reporting, warning output, refactoring etc.
Also misses the volume reuse/reclaim algorithms.
But it passes the unit tests now, with and without a local database.
git-svn-id: https://duplicati.googlecode.com/svn/sandboxes/Kenneth/ForestHash@1526 59da171f-624f-0410-aa54-27559c288bec