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

INITIAL REVIEW: Update path to welcome project in newer builds #1639

Closed
wants to merge 1 commit into from

Conversation

njx
Copy link
Contributor

@njx njx commented Sep 13, 2012

@gruehle

This is a proposed fix for #1512. It's a little more code change than I'd like, so I'm just putting this up for initial review now.

The overall changes are:

  • Instead of storing projects as just a path string, we store them as a "project info" object, which has the root path as well as a "type". Currently, the only types are "welcome" and "localFolder" (the idea being that in the future we could have other project types, with additional metadata). This applies to the pref for the last opened project as well as the list of recent projects maintained by the recent projects extension.
  • When accessing either the last opened project or the recent projects list, we check for the welcome project, and change its root path to be whatever the welcome project is for the currently running source folder.

Note that we don't detect welcome projects from before this sprint, so people upgrading from Sprint 13 to Sprint 14 will still have the old welcome project in their last opened project/recent projects list. (However, the last opened project/recent projects list from older sprints will still be recognized even though they're in a different format.) We'll need to release note this.

The main concerns I have are that there are a fair number of cases that are affected, and the logic in the recent projects dropdown has changed enough that we really need to do a thorough retest. I've tested the ones I could think of, but there might be more.

Here are the cases I can think of, along with their expected behavior:

  1. Trash prefs and launch Brackets to get the Getting Started project. Quit Brackets. Restart Brackets with a new source folder. You should see the Getting Started project from the new folder.
  2. Trash prefs and launch Brackets to get the Getting Started project. Open another folder, so the recent projects dropdown now has the Getting Started project in it. Quit Brackets. Restart Brackets with a new source folder. The recent projects dropdown should now have the Getting Started project from the new folder.
  3. Like (1), but instead of restarting Brackets with a new source folder, just switch the language before relaunching. You should see the Getting Started project for the new language.
  4. Like (2), but instead of restarting Brackets with a new source folder, just switch the language before relaunching. You should see the Getting Started project for the new language in the recent projects dropdown.
  5. Trash prefs and launch Brackets Sprint 13. Open some folders. Quit Brackets. Launch Brackets Sprint 14. The last opened project and recent projects dropdown should still show what they showed in Sprint 13. (However, the Getting Started project from Sprint 13 will still be there.)

Note that this also means that the last opened project/recent projects won't be saved if you downgrade from >=Sprint 14 to <Sprint 14.

We need to add some unit tests for all this stuff. Some of these cases will be tricky to unit test, as it involves prefs being set up in certain ways and different source folders. Probably the only way to do it is to manually synthesize the prefs for each test. (Also, there weren't any unit tests for the recent projects dropdown to begin with...a by-product of the fact that the criteria for the last sprint were "just check it in" :) We probably need to write some.)

…pdated with the current welcome project path as necessary.

initialPath = FileUtils.convertToNativePath(initialPath);
return initialPath;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above method was just moved verbatim from later in the file to prevent JSLint from complaining.

@ghost ghost assigned gruehle Sep 13, 2012
@njx
Copy link
Contributor Author

njx commented Sep 13, 2012

Closing. @gruehle has a good idea for a less invasive fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants