forked from andriyko/sublime-robot-framework-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobot.py
26 lines (22 loc) · 917 Bytes
/
Robot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
Robot Framework from sublime is a autocompletion plugin for Sublime Text 3
"""
import sys
import os
from string import Template
from .commands import *
if sys.version_info < (3, 3):
raise RuntimeError('Plugin only works with Sublime Text 3')
def plugin_loaded():
package_folder = os.path.dirname(__file__)
if not os.path.exists(os.path.join(package_folder, 'Main.sublime-menu')):
template_file = os.path.join(
package_folder, 'templates', 'Main.sublime-menu.tpl'
)
with open(template_file, 'r', encoding='utf8') as tplfile:
template = Template(tplfile.read())
menu_file = os.path.join(package_folder, 'Main.sublime-menu')
with open(menu_file, 'w', encoding='utf8') as menu:
menu.write(template.safe_substitute({
'package_folder': os.path.basename(package_folder)
}))