Skip to content
Browse files

Merge remote-tracking branch 'origin/master' into debug_args

  • Loading branch information...
2 parents ca51342 + ae1968a commit b0a308d09765409800162a48c788501083ae25fe @cool-RR committed Mar 16, 2012
Showing with 41 additions and 0 deletions.
  1. +9 −0 README.markdown
  2. +32 −0 scripts/show_file_in_explorer.py
View
9 README.markdown
@@ -249,6 +249,15 @@ Also deletes trailing spaces.
Suggested key combination: `Alt-Insert End`
+## show-file-in-explorer ##
+
+Open the currently-edited file's folder in Explorer.
+
+Implementd only for Windows.
+
+Suggested key combination: `Alt-Insert Ctrl-J`
+
+
## slash-line ##
Slash a long line into 2 lines, putting a `\` character as a separator.
View
32 scripts/show_file_in_explorer.py
@@ -0,0 +1,32 @@
+# Copyright 2009-2011 Ram Rachum.
+# This program is distributed under the LGPL2.1 license.
+
+'''
+This module defines the `show_file_in_explorer` script.
+
+See its documentation for more information.
+'''
+
+from __future__ import division
+from __future__ import with_statement
+
+import os.path, sys; sys.path.append(os.path.dirname(__file__))
+
+import wingapi
+
+import shared
+
+
+def show_file_in_explorer(editor=wingapi.kArgEditor):
+ '''
+ Open the currently-edited file's folder in Explorer.
+
+ Implementd only for Windows.
+ '''
+ # todo feature: Select the file in the Explorer window after opening it.
+ assert isinstance(editor, wingapi.CAPIEditor)
+ if os.name != 'nt':
+ raise NotImplemented('Implemented for Windows only, sorry!')
+ path_to_file = editor.GetDocument().GetFilename()
+ folder, _ = os.path.split(path_to_file)
+ os.startfile(folder)

0 comments on commit b0a308d

Please sign in to comment.
Something went wrong with that request. Please try again.