adobe/brackets — pull request #5527 by peterflynn (2013-10-15 20:38:47+00:00)
Title: Better compartmentalize code that assumes no trailing "/"

The "canonical" folder path format used in DirectoryEntry.fullPath includes a trailing "/". However, we have some Brackets code that requires or generates paths in the _opposite_ format. This cleans up several of those cases:

* Rename FileUtils.canonicalizeFolderPath() to stripTrailingSlash() since it actually makes paths NOT canonical. Old API is **deprecated** but left in place for now (it's used by several extensions -- I'll file bugs once this lands).
* Add warning to docs for two other APIs that return non-canonical paths: FileUtils.getNativeBracketsDirectoryPath() & FileUtils.getNativeModuleDirectoryPath()
* Indicate explicitly that ProjectManager._loadProject() / openProject() support receiving non-canonical paths
* Fix several ProjectManager APIs that used to return and/or receive non-canonical paths -- getInitialProjectPath(), _getWelcomeProjectPath(), updateWelcomeProjectPath(). No extensions use these APIs.
* Centralize code that touches "welcomeProjects" pref storage, for clarity

This is an incremental improvement. Not everything has been cleaned up:
* Some code still calls openProject() with non-canonical paths
* RecentProjects still works with non-canonical paths internally (including its pref storage)
* The list of previous "welcomeProjects" is still stored non-canonicalized
* ScopeManager (in JS code hints) still requires non-canonical paths in some places (while requiring _canonical_ paths in others! :joy:)
* The two getNative*() APIs above still return non-canonical paths -- though I think we can fix these soon. It will be safer to change these once we have the new filesystem because it's more careful about handling duplicated slashes.