File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33# @Author: lime
44# @Date: 2013-10-28 13:39:48
55# @Last Modified by: Lime
6- # @Last Modified time: 2014-07-31 10:19:46
6+ # @Last Modified time: 2014-08-02 17:43:53
77
88import os
99import sys
@@ -152,11 +152,10 @@ def get_user():
152152
153153def get_project_name ():
154154 '''Get project name'''
155+
155156 project_data = sublime .active_window ().project_data ()
156- if project_data :
157- project = os .path .basename (project_data ['folders' ][0 ]['path' ])
158- else :
159- project = None
157+ project = os .path .basename (project_data ['folders' ][0 ]['path' ]) if project_data else None
158+
160159 return project
161160
162161
@@ -232,12 +231,14 @@ def get_st2_time():
232231 args .update ({
233232 'create_time' : c_time .strftime (format ),
234233 'last_modified_time' : m_time .strftime (format ),
235- 'project_name' : get_project_name (),
236234 'file_name' : file_name ,
237235 'file_name_without_extension' : file_name_without_extension ,
238236 'file_path' : file_path
239237 })
240238
239+ if IS_ST3 :
240+ args .update ({'project_name' : get_project_name ()})
241+
241242 user = get_user ()
242243 if 'author' not in args :
243244 args .update ({'author' : user })
Original file line number Diff line number Diff line change 194194
195195 The project name.
196196
197+ Note: `project_name` only works in ST3.
198+
197199 Can't be set custom.
198200 */
199201
Original file line number Diff line number Diff line change @@ -293,6 +293,8 @@ There are two kinds of arguments: **options** and kinds of languages variables s
293293
294294 The project name.
295295
296+ Note: `project_name ` only works in ST3.
297+
296298 Can't be set custom.
297299 */
298300
You can’t perform that action at this time.
0 commit comments