-# yaffs_chmod(file_path, file["mode"]);
-# if output>=0:
-# debug_message(( "chmoding file:", output), 2)
-# else :
-# debug_message(( "error chmoding file:", output), 0)
-# check_for_yaffs_errors(output)
+ yaffs_chmod(file_path, file["mode"]);
+ if output>=0:
+ debug_message(( "chmoding file:", output), 2)
+ else :
+ debug_message(( "error chmoding file:", output), 0)
+ check_for_yaffs_errors(output)
+
+
+
+def create_dir(dir, scanned_path, yaffs_path):
+ debug_message( "\n \n \n", 2)
+ absolute_dir_path=join_paths(yaffs_path, subtract_paths(dir["path"],scanned_path))
+ debug_message( ("creating dir:", absolute_dir_path), 2)
+ debug_message (("mode(in octal", oct(dir["mode"])), 2)
+
+
+ ##if there is already a dir in yaffs then remove the dir . this is to clean the yaffs folder if it already exists.
+ if yaffs_access(absolute_dir_path, 0)==0:##the 0 means does it exist.
+ debug_message ("folder already exists in yaffs", 2)
+ output=yaffs_unlink(absolute_dir_path)
+ debug_message(("unlinking", absolute_dir_path, output), 2)
+ check_for_yaffs_errors(output)
+
+ ##shis is a bug in yaffs which will not make a dir if there is a slash on the end
+ if absolute_dir_path[len(absolute_dir_path)-1]=="/":
+ absolute_dir_path=absolute_dir_path[0:len(absolute_dir_path)-1]
+ debug_message (("path has slash on the end. removing slash new path is:",absolute_dir_path) , 4)
+
+ output=yaffs_mkdir(absolute_dir_path, dir["mode"] )
+ if output>=0:
+ debug_message(( "creating dir:", output), 2)
+ else :
+ debug_message(( "error creating dir:", output), 0)
+ check_for_yaffs_errors(output)
+
+
+