def current_package_name(self):
view = self.window.active_view()
spp = os.path.realpath(sublime.packages_path())
if view and view.file_name():
file_path = os.path.realpath(view.file_name())
if file_path.endswith(".py") and file_path.startswith(spp):
# path on Windows may not be properly cased
# https://github.com/randy3k/AutomaticPackageReloader/issues/10
file_path = casedpath(file_path)
return file_path[len(spp):].split(os.sep)[1]
folders = self.window.folders()
if folders and len(folders) > 0:
first_folder = os.path.realpath(folders[0])
if first_folder.startswith(spp):
return os.path.basename(casedpath(first_folder))
return None
package_reloader.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录