# HG changeset patch # User charles # Date 1255404005 -3600 # Node ID 1206ae06f03d49914e423c96238d5d6fd8e38ed5 # Parent fd8194c28cac3b3b918af5acb36a58e187ff8675 More python example stuff diff --git a/direct/python/examples.py b/direct/python/examples.py --- a/direct/python/examples.py +++ b/direct/python/examples.py @@ -22,10 +22,28 @@ def yaffs_ls(dname): yaffs_ls(fullname) sep = yaffs_readdir(dc) + yaffs_closedir(dc) + return 0 else: print "Could not open directory" return -1 +def yaffs_mkfile(fname,fsize): + fd = yaffs_open(fname,66, 0666) + if fd >= 0: + b = create_string_buffer("",1024) + totalwrite=0 + while fsize > 0: + thiswrite = 1024 if fsize > 1024 else fsize + result = yaffs_write(fd,b,thiswrite) + totalwrite += result + fsize -= result + if result != thiswrite: + fsize= 0 + + return totalwrite + else : + return -1 root = "/yaffs2"