Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

File System API Migration

Peter Flynn edited this page Oct 8, 2013 · 30 revisions

Here are the API changes that will result from the [File System Evolution](File System) plan:

Old API New API Suggested action Usage
FileUtils.readAsText(fileEntry) FileUtils.readAsText(file) Already drop-in compatible
FileUtils.writeText(fileEntry) FileUtils.writeText(file) Already drop-in compatible
FileIndexManager.getFileInfoList("all")
FileIndexManager.getFileInfoList("...")
filesystem.getFileList()
filesystem.getFileList(filter)
_Note: returns an array of actual Files, but they provide the same properties as the old FileInfos)_
Shim with deprecation warning
FileIndexManager.getFilenameMatches("...", filename) filesystem.getFileList(filter) Shim with deprecation warning
ProjectManager.shouldShow(entry) filesystem.shouldShow(fullPath) Leave old API in place permanently
ProjectManager.isBinaryFile(name/fullPath) ??? Shim with deprecation warning. New API on LanguageManager.
new NativeFileSystem.FileEntry(fullPath)
new NativeFileSystem.DirectoryEntry(fullPath)
filesystem.getFileForPath(fullPath)
filesystem.getDirectoryForPath(fullPath)
Shim with deprecation warning
DirectoryEntry.getFile(relpath) filesystem.resolve(path) Do not shim (callers will break right away)
NativeFileSystem.resolveNativeFileSystemPath(fullPath) filesystem.resolve(path) Shim with deprecation warning
NativeFileSystem.requestNativeFileSystem(fullPath)... fs.root filesystem.resolve(fullPath) Shim with deprecation warning _(maybe?)_
Concatenation: folderPath + "/" + filename (same) (no change)
Concatenation: folderPath + filename folderPath + "/" + filename **Open question**
Substrings: relpath = fullPath.slice(dirFullPath.length) relpath = fullPath.slice(dirFullPath.length + 1) **Open question**
entry.isFile, entry.isDirectory entry.isFile(), entry.isDirectory() Change API to use a read-only property (like fullPath)
NativeFileSystem.showOpenDialog()
NativeFileSystem.showSaveDialog()
filesystem.showOpenDialog()
filesystem.showSaveDialog()
Shim with deprecation warning _(maybe?)_ **TODO**
fileEntry.getMetadata() file.stat()
_TODO: document change in data structure too_
Do not shim (callers will break right away)
fileEntry.createWriter()... writer.write(text) file.write(text) Do not shim (callers will break right away)
fileEntry.file()... new NativeFileSystem.FileReader().readAsText(fileResult) file.readAsText() Do not shim (callers will break right away)
directoryEntry.createReader().readEntries() directory.getContents() ??? Do not shim (callers will break right away) **TODO**
DirectoryEntry.getFile(relpath, {create:true}) filesystem.getFileForPath(fullPath).write("")
Note: as a result, this can fold in writeText() or createWriter()/write() calls that used to immediately follow the getFile() call.
Do not shim (callers will break right away)
TODO: add a cleaner create() API?
DirectoryEntry.getDirectory(relpath, {create:true}) filesystem.getDirectoryForPath(fullPath).create() Do not shim (callers will break right away)
instanceof NativeFileSystem.InaccessibleFileEntry instanceof InMemoryFile Do not shim (callers will break right away)
entry.remove() entry.moveToTrash() Do not shim (callers will break right away)
brackets.fs.makedir(fullPath, ???0???) filesystem.getDirectoryForPath(fullPath).create() Do not shim (callers will break right away)
brackets.fs.unlink(fullPath) entry.unlink() Do not shim (callers will break right away)
brackets.fs.rename(oldFullPath, newFullPath) entry.rename(newFullPath)
(NOTE: Exact semantics of this call are still a bit TBD).
Do not shim (callers will break right away)
brackets.fs.chmod() ??? Do not shim (callers will break right away)
new NativeFileSystem.InaccessibleFileEntry(fakePath) filesystem.getInMemoryFile(fakePath) Do not shim (callers will break right away)
old new action
Clone this wiki locally