BufferCache now creates folders as necessary in openFile().

git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_storage_cleanup@255 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
index 331c48c..6434b4d 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
@@ -14,6 +14,7 @@
  */
 package edu.uci.ics.hyracks.storage.common.buffercache;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
@@ -502,7 +503,12 @@
             if (fInfo == null) {
                 String fileName = fileMapManager.lookupFileName(fileId);
                 try {
-                    fInfo = new FileHandle(fileId, new RandomAccessFile(fileName, "rw"));
+                	File f = new File(fileName);
+                    if(!f.exists()) {
+                    	File dir = new File(f.getParent());        	
+                    	dir.mkdirs();
+                    }
+                	fInfo = new FileHandle(fileId, new RandomAccessFile(f, "rw"));
                 } catch (IOException e) {
                     throw new HyracksDataException(e);
                 }