Skip to content

Instantly share code, notes, and snippets.

@ajoberstar
Created January 16, 2013 02:22
Show Gist options
  • Save ajoberstar/4544076 to your computer and use it in GitHub Desktop.
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.
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