User talk:David corrales

From ScummVM :: Wiki
Revision as of 23:23, 23 March 2007 by Fingolfin (talk | contribs)
Jump to navigation Jump to search

Google Summer of Code: Filesystem API

This page holds additional information concerning my proposal for working to redesign the current Filesystem API.

It should be noted that the diagrams don't list all methods (for example, when a class inherits them) for brevity and clarity. During the project development, the diagrams will become accurate and exact.

Current Filesystem API implementation

Fs1.png

Filesystem Node Redesign Proposal

Fs2.png

Common::File Redesign Proposal

Fs3.png

Possible new operations

This section describes possible new file/path operations to be added to ScummVM. If the method will be similar to an existing one, it'll be noted in parentheses after the description.

The format used is methodName(param1, ..., paramN) -> ret1, ..., retN: description.


split(path) -> head, tail: split the pathname path into a pair, (head, tail) where tail is the last pathname component and head is everything leading up to that. (python os.path)

splitDrive(path) -> drive, tail: split the pathname path into a pair (drive, tail) where drive is either a drive specification or the empty string. (python os.path)

getSeparator() -> string: returns the separator used in the current backend. For example, "/" for Unix or "\" for Windows.

isAbsolute(path) -> bool: return True if path is an absolute pathname (begins with a slash). (python os.path)

isReadable(path) -> bool: true if the file can be read.

isWriteable(path) -> bool: true if the file can be written.

count(dir) -> int: returns the total number of directories and files in the directory. (Qt)

listDir(list, mode, filter) -> list: lists the dir, with the given mode and filter. This function is already present. The idea is to augment it with filters

isHidden(path) -> bool: tests whether the file pathname is a hidden file. (Java)

getCanonicalPath(path) -> path: returns the canonical pathname string of the abstract pathname. (Java)

Misc

You might want to keep in minde that a "path" can refer to:

  • an existing file (which hence might be writable or readable or both)
  • an existing directory (which can be writeable, too, with different meaning)
  • a not yet existing but valid path to a file/dir (which is neither readable nor writeable, I guess).

Well, that's not really a brilliant observation ; I just wanted to make sure this will be considered in the design process Fingolfin 00:22, 24 March 2007 (CET)