- file_path=files_in_snapshot[i]["path"][len(path):]
- current_handle=yaffs_open("yaffs2/"+file_path, 66, files_in_snapshot[i]["mode"])
+ print "\n \n \n"
+ file_path="/yaffs2/"+files_in_snapshot[i]["path"][len(path):]
+ print "creating file:", file_path
+ print "mode", files_in_snapshot[i]["mode"]
+ current_handle=yaffs_open(file_path, yaffs_O_CREAT | yaffs_O_TRUNC| yaffs_O_RDWR, files_in_snapshot[i]["mode"])
+ data_file=open(files_in_snapshot[i]["path"], "r")
+ yaffs_lseek(current_handle, 0, 0)
+ data_to_be_written= data_file.read()
+
+
+ #print "data to be saved", data_to_be_written
+ length_of_file=len(data_to_be_written)
+ print "length of data to be written",length_of_file
+ output=yaffs_write(current_handle,data_to_be_written , length_of_file)
+ print "writing file:", output
+ yaffs_ftruncate(current_handle, length_of_file)
+