Changeset 196
- Timestamp:
- 11/04/02 15:32:22 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/j/Utilities.java
r73 r196 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: Utilities.java,v 1. 2 2002-10-10 16:26:59piso Exp $5 * $Id: Utilities.java,v 1.3 2002-11-04 15:32:22 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 964 964 { 965 965 // No need to back it up if it doesn't exist. 966 if (!file. exists())966 if (!file.isFile()) 967 967 return true; 968 968 File backupDir = null; … … 973 973 } else { 974 974 // Use default location. 975 backupDir = File.getInstance(Editor.getUserHomeDirectory(), "backup"); 975 backupDir = File.getInstance(Directories.getUserHomeDirectory(), 976 "backup"); 976 977 } 977 978 if (backupDir == null) 978 979 return false; 979 if (!backupDir. exists() && !backupDir.mkdirs()) {980 if (!backupDir.isDirectory() && !backupDir.mkdirs()) { 980 981 Log.error("can't create backup directory ".concat(backupDir.canonicalPath())); 981 982 return false; … … 988 989 return true; 989 990 } 990 if (copyFile(file, backupFile)) {991 if (copyFile(file, backupFile)) 991 992 return true; 993 // If copyFile() failed because the existing backup file is not 994 // writable, delete that file and try again. 995 if (backupFile.isFile() && !backupFile.canWrite()) { 996 Log.debug("deleting old backup file " + backupFile); 997 backupFile.delete(); 998 Log.debug("retrying copyFile..."); 999 if (copyFile(file, backupFile)) 1000 return true; 992 1001 } 993 1002 Log.error("makeBackup copyFile failed, returning false");
Note: See TracChangeset
for help on using the changeset viewer.