From: <ga...@us...> - 2009-03-19 22:10:57
|
Revision: 5123 http://jnode.svn.sourceforge.net/jnode/?rev=5123&view=rev Author: galatnm Date: 2009-03-19 22:10:41 +0000 (Thu, 19 Mar 2009) Log Message: ----------- Fix in memory creation of directory. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusEntry.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java 2009-03-19 19:48:22 UTC (rev 5122) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java 2009-03-19 22:10:41 UTC (rev 5123) @@ -51,12 +51,9 @@ LeafRecord record) { super(fs, parent, name, record); this.folder = new CatalogFolder(record.getData()); + this.entries = FSEntryTable.EMPTY_TABLE; } - public FSEntryTable getTable() { - return entries; - } - @Override public FSEntry addDirectory(String name) throws IOException { log.debug("<<< BEGIN addDirectory " + name + " >>>"); @@ -121,6 +118,10 @@ return null; } + public int rename(String oldName, String newName) { + return entries.rename(oldName, newName); + } + @Override public void remove(String name) throws IOException { if (fs.isReadOnly()) { @@ -188,7 +189,7 @@ if (rec.getType() == CatalogFolder.RECORD_TYPE_FOLDER || rec.getType() == CatalogFile.RECORD_TYPE_FILE) { String name = ((CatalogKey) rec.getKey()).getNodeName().getUnicodeString(); - HFSPlusEntry e = new HFSPlusEntry(fs, this, name, rec); + HFSPlusEntry e = new HFSPlusDirectory(fs, this, name, rec); pathList.add(e); } } @@ -216,7 +217,8 @@ CatalogThread thread = new CatalogThread(CatalogFolder.RECORD_TYPE_FOLDER_THREAD, this.folder .getFolderId(), dirName); - CatalogFolder newFolder = new CatalogFolder(0, new CatalogNodeId(volumeHeader.getNextCatalogId())); + CatalogFolder newFolder = + new CatalogFolder(0, new CatalogNodeId(volumeHeader.getNextCatalogId())); log.debug("New catalog folder :\n" + newFolder.toString()); CatalogKey key = new CatalogKey(this.folder.getFolderId(), dirName); @@ -225,7 +227,7 @@ LeafRecord folderRecord = new LeafRecord(key, newFolder.getBytes()); log.debug("New record folder :\n" + folderRecord.toString()); - HFSPlusEntry newEntry = new HFSPlusEntry(fs, this, name, folderRecord); + HFSPlusEntry newEntry = new HFSPlusDirectory(fs, this, name, folderRecord); volumeHeader.setFolderCount(volumeHeader.getFolderCount() + 1); log.debug("New volume header :\n" + volumeHeader.toString()); Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusEntry.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusEntry.java 2009-03-19 19:48:22 UTC (rev 5122) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusEntry.java 2009-03-19 22:10:41 UTC (rev 5123) @@ -84,7 +84,7 @@ @Override public FSDirectory getDirectory() throws IOException { - if (!isFile()) { + if (!isDirectory()) { throw new IOException("It is not a Directory"); } return (HFSPlusDirectory) this; @@ -123,7 +123,7 @@ public boolean isDirty() throws IOException { return dirty; } - + public void setDirty() { dirty = true; } @@ -147,7 +147,7 @@ if (type == AbstractFSEntry.ROOT_ENTRY) { throw new IOException("Cannot change name of root directory"); } - if (parent.getTable().rename(name, newName) < 0) { + if (parent.rename(name, newName) < 0) { throw new IOException("Cannot change name"); } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-03-19 19:48:22 UTC (rev 5122) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-03-19 22:10:41 UTC (rev 5123) @@ -100,7 +100,7 @@ log.info("Create root entry."); LeafRecord record = catalog.getRecord(CatalogNodeId.HFSPLUS_POR_CNID); if (record != null) { - return new HFSPlusEntry(this, null, "/", record); + return new HFSPlusDirectory(this, null, "/", record); } log.error("Root entry : No record found."); return null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |