Favorites prefixed with ‘[DIR]’ show folders within

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.
This commit is contained in:
Allan Odgaard
2012-08-16 16:28:01 +02:00
parent 8a5fb16367
commit fee36aaec9

View File

@@ -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;