forked from adobe/brackets
-
Notifications
You must be signed in to change notification settings - Fork 278
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 | 13 |
FileUtils.writeText(fileEntry) | FileUtils.writeText(file) | Already drop-in compatible | 5 |
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 | 7 |
FileIndexManager.getFilenameMatches("...", filename) | filesystem.getFileList(filter) | Shim with deprecation warning | None |
ProjectManager.shouldShow(entry) | filesystem.shouldShow(fullPath) | Leave old API in place permanently | None? |
ProjectManager.isBinaryFile(name/fullPath) | ??? | Shim with deprecation warning. New API on LanguageManager. | None |
new NativeFileSystem.FileEntry(fullPath) new NativeFileSystem.DirectoryEntry(fullPath) |
filesystem.getFileForPath(fullPath) filesystem.getDirectoryForPath(fullPath) |
Shim with deprecation warning | 19 |
DirectoryEntry.getFile(relpath) | filesystem.resolve(path) | Do not shim (callers will break right away) | 4 |
NativeFileSystem.resolveNativeFileSystemPath(fullPath) | filesystem.resolve(path) | Shim with deprecation warning | 4 |
NativeFileSystem.requestNativeFileSystem(fullPath)... fs.root | filesystem.resolve(fullPath) | Shim with deprecation warning | 6 |
Concatenation: folderPath + "/" + filename | (same) | Normalize paths on ingest to allow this | |
Concatenation: folderPath + filename | folderPath + "/" + filename | Change all directory paths to end in "/" to allow this | Unclear, but at least several |
Substrings: relpath = fullPath.slice(dirFullPath.length) | relpath = fullPath.slice(dirFullPath.length + 1) | (Above change removes this diff too) | |
entry.isFile, entry.isDirectory | entry.isFile(), entry.isDirectory() | Change API to use a read-only property (like fullPath) | 9 |
NativeFileSystem.isRelativePath() | ??? | ??? | None |
NativeFileSystem.showOpenDialog() NativeFileSystem.showSaveDialog() |
filesystem.showOpenDialog() filesystem.showSaveDialog() |
Shim with deprecation warning | 4 |
fileEntry.getMetadata() | file.stat() _TODO: document change in data structure too_ |
Do not shim (callers will break right away) | 1 |
fileEntry.createWriter()... writer.write(text) | file.write(text) | Do not shim (callers will break right away) | 5, but only used in 2 |
fileEntry.file()... new NativeFileSystem.FileReader().readAsText(fileObj) | file.readAsText() | Do not shim (callers will break right away) | None |
directoryEntry.createReader().readEntries() | directory.getContents() ??? | Do not shim (callers will break right away) | 5 |
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? |
2 |
DirectoryEntry.getDirectory(relpath, {create:true}) | filesystem.getDirectoryForPath(fullPath).create() | Do not shim (callers will break right away) | 2 |
instanceof NativeFileSystem.InaccessibleFileEntry | instanceof InMemoryFile | Do not shim (callers will break right away) | 1(ish) |
entry.remove() | entry.moveToTrash() | Do not shim (callers will break right away) | None |
NativeFileError.* | ??? | Do not shim (callers will break right away) | 1(ish) |
entry.filesystem (not a very useful API) |
n/a | Do not shim (callers will break right away) | None |
NativeFileSystem.Encodings.* | ??? | Do not shim (callers will break right away) | None |
brackets.fs.readFile() brackets.fs.writeFile() |
file.readAsText() file.write(text) |
**TODO: Consider shimming** | 2 |
brackets.fs.stat() | file.stat() | Do not shim (callers will break right away) | 1 |
brackets.fs.readdir() | directory.getContents() ??? | Do not shim (callers will break right away) | 1 |
brackets.fs.makedir(fullPath, mode) | filesystem.getDirectoryForPath(fullPath).create() | Do not shim (callers will break right away) | 1 |
brackets.fs.unlink(fullPath) | entry.unlink() | Do not shim (callers will break right away) | None |
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) | None |
brackets.fs.moveToTrash() | entry.moveToTrash() | Do not shim (callers will break right away) | None |
brackets.fs.copyFile() | ??? | Do not shim (callers will break right away) | 1 |
brackets.fs.isNetworkDrive() | ??? | ??? | None |
brackets.fs.chmod() | ??? | Do not shim (callers will break right away) | None |
brackets.fs.showOpenDialog() brackets.fs.showSaveDialog() |
filesystem.showOpenDialog() filesystem.showSaveDialog() |
Do not shim (callers will break right away) | None |
new NativeFileSystem.InaccessibleFileEntry(fakePath) | filesystem.getInMemoryFile(fakePath) | Do not shim (callers will break right away) | None |
brackets.fs.ERR_* brackets.fs.PATH_EXISTS_ERR brackets.fs.NO_ERROR |
??? | Do not shim (callers will break right away) | 1 |
"Usage" = how many extensions currently use the API
The following extensions use at least one API in the "Do not shim (callers will break right away)" category:
- ...