More on file methods

Mukhsein Johari <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
Hi all, sorry for picking on things but I think it
would be better to keep the APIs small and consistent.
Right now the file and dir interface is too large,
IMHO.

----------------
File.move(dir)           # move File to location "dir"
(Dir object), not for renaming
----------------

What about making links (symbolic and hard)?

-----------------
File.setUPerms(uperms = 0x600)  # sets unix
permissions
File.setAttrs(readOnly = None, executable = None,
hidden = None) # setAttrs will set an
# attribute to True or False if specified as an
argument.  Otherwise the attribute is
# left unchanged.
File.modTime()           # returns modification
DateTime object
File.setModTime(time)    # set modification time to
time DateTime object
-----------------

Can we not consolidate all this to normal attribute
access?

myfile = File('/somedir/somefile.txt', '')

myfile.modTime = myDateTimeObj (write attr)
myfile.modTime (read attr)

Read only attrs, of course will give exceptions when
you try to assign a value. (eg. size)

Also, we need a 'cross-platform' way to set read-only,
executable etc. attrs. In unix it's done very
differently to windows. Read only would set the uperms
on unix. (it bitwise or's the uperms)

 


________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.