Created
January 16, 2013 02:22
-
-
Save ajoberstar/4544076 to your computer and use it in GitHub Desktop.
Script that will remove projects that no longer exist from Sublime Text 2 "recent projects" list.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonBuilder | |
import groovy.json.JsonSlurper | |
def session = new File('C:/Users/<user name here>/AppData/Roaming/Sublime Text 2/Settings/Session.sublime_session') | |
def json = session.withReader { reader -> | |
new JsonSlurper().parse(reader) | |
} | |
json.workspaces.recent_workspaces.retainAll { new File(it.replaceAll(/^\/(\w+)/, '$1:')).exists() } | |
def builder = new JsonBuilder() | |
builder(json) | |
session.withWriter { writer -> | |
writer.println builder.toPrettyString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment