From fee36aaec98207fa1e8f25f6ac75b89d69d00635 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Thu, 16 Aug 2012 16:28:01 +0200 Subject: [PATCH] =?UTF-8?q?Favorites=20prefixed=20with=20=E2=80=98[DIR]?= =?UTF-8?q?=E2=80=99=20show=20folders=20within?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For example if you have all your projects under ~/Projects then you can do: mkdir -p ~/Library/Application\ Support/TextMate/Favorites cd ~/Library/Application\ Support/TextMate/Favorites ln -s ~/Projects "[DIR] My Projects" This will then have all the folders inside ~/Projects show when you choose Open Favorites… (⇧⌘O). Long-term it might be useful to store actual property lists in the favorites folder, akin to smart folders (i.e. describe a query for what to show) and/or allow descending into the folders shown in the ⇧⌘O window. --- Applications/TextMate/src/Favorites.mm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Applications/TextMate/src/Favorites.mm b/Applications/TextMate/src/Favorites.mm index d63833c3..ab20390c 100644 --- a/Applications/TextMate/src/Favorites.mm +++ b/Applications/TextMate/src/Favorites.mm @@ -74,7 +74,21 @@ citerate(entry, path::entries(favoritesPath)) { if((*entry)->d_type == DT_LNK) - favorites.insert(std::make_pair((*entry)->d_name, path::resolve(path::join(favoritesPath, (*entry)->d_name)))); + { + std::string const& path = path::resolve(path::join(favoritesPath, (*entry)->d_name)); + if(strncmp("[DIR] ", (*entry)->d_name, 6) == 0) + { + citerate(subentry, path::entries(path)) + { + if((*subentry)->d_type == DT_DIR) + favorites.insert(std::make_pair(text::format("%s — %s", (*subentry)->d_name, (*entry)->d_name + 6), path::join(path, (*subentry)->d_name))); + } + } + else + { + favorites.insert(std::make_pair((*entry)->d_name, path)); + } + } } } return self;