diff --git a/Ghidra/Framework/FileSystem/src/main/java/ghidra/framework/store/local/IndexedLocalFileSystem.java b/Ghidra/Framework/FileSystem/src/main/java/ghidra/framework/store/local/IndexedLocalFileSystem.java index 056d4a63b8..a1dd2ffaf7 100644 --- a/Ghidra/Framework/FileSystem/src/main/java/ghidra/framework/store/local/IndexedLocalFileSystem.java +++ b/Ghidra/Framework/FileSystem/src/main/java/ghidra/framework/store/local/IndexedLocalFileSystem.java @@ -588,29 +588,29 @@ public class IndexedLocalFileSystem extends LocalFileSystem { return false; } + String conflictedItemStorageName = findItemStorageName(parentPath, name); + + String storageName = pfile.getStorageName(); + + if (conflictedItemStorageName != null) { + try { + if (storageName.compareTo(conflictedItemStorageName) <= 0) { + conflictedItemStorageName = storageName; + return true; // skip conflict orphan + } + + // remove conflict orphan from index and, add newer item below + deallocateItemStorage(parentPath, name); + } + finally { + Msg.warn(this, + "Detected orphaned project file " + conflictedItemStorageName + ": " + + getPath(parentPath, name)); + } + } + indexJournal.open(); try { - String conflictedItemStorageName = findItemStorageName(parentPath, name); - - String storageName = pfile.getStorageName(); - - if (conflictedItemStorageName != null) { - try { - if (storageName.compareTo(conflictedItemStorageName) <= 0) { - conflictedItemStorageName = storageName; - return true; // skip conflict orphan - } - - // remove conflict orphan from index and, add newer item below - deallocateItemStorage(parentPath, name); - } - finally { - Msg.warn(this, - "Detected orphaned project file " + conflictedItemStorageName + ": " + - getPath(parentPath, name)); - } - } - Folder folder = addFolderToIndexIfMissing(parentPath); Item item = new Item(folder, name, pfile.getStorageName()); bumpNextFileIndexID(item.getStorageName());