DS-1754 Use canonical not absolute path

Using the canonical path when determining the location of the undo information
leads to consistent behaviour when using "." as the source vs using eg an
absolute path. This also adds the name of the directory to the error message in
case the directory cannot be created, to help with troubleshooting.
This commit is contained in:
Andrea Schweer
2013-11-05 12:30:01 +13:00
parent e16b9b4f12
commit 66414dda73

View File

@@ -515,7 +515,7 @@ public class ItemUpdate {
private File initUndoArchive(File sourceDir)
throws FileNotFoundException, IOException
{
File parentDir = sourceDir.getAbsoluteFile().getParentFile();
File parentDir = sourceDir.getCanonicalFile().getParentFile();
if (parentDir == null)
{
throw new FileNotFoundException("Parent directory of archive directory not found; unable to write UndoArchive; no processing performed");
@@ -533,8 +533,8 @@ public class ItemUpdate {
// create root directory
if (!undoDir.mkdir())
{
pr("ERROR creating Undo Archive directory ");
throw new IOException("ERROR creating Undo Archive directory ");
pr("ERROR creating Undo Archive directory " + undoDir.getCanonicalPath());
throw new IOException("ERROR creating Undo Archive directory " + undoDir.getCanonicalPath());
}
//Undo is suppressed to prevent undo of undo