mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
only check for .wakatime.conf if api_key setting not set
This commit is contained in:
parent
fc2776a125
commit
a389c456ad
@ -36,20 +36,21 @@ def convert_config_to_sublime_settings():
|
|||||||
# To be backwards compatible, rename config file
|
# To be backwards compatible, rename config file
|
||||||
settings = sublime.load_settings(SETTINGS)
|
settings = sublime.load_settings(SETTINGS)
|
||||||
api_key = settings.get('api_key', '')
|
api_key = settings.get('api_key', '')
|
||||||
try:
|
if not api_key:
|
||||||
with open(join(expanduser('~'), '.wakatime.conf')) as old_file:
|
try:
|
||||||
for line in old_file:
|
with open(join(expanduser('~'), '.wakatime.conf')) as old_file:
|
||||||
line = line.split('=', 1)
|
for line in old_file:
|
||||||
if line[0] == 'api_key':
|
line = line.split('=', 1)
|
||||||
api_key = line[1].strip()
|
if line[0] == 'api_key':
|
||||||
except IOError:
|
api_key = line[1].strip()
|
||||||
pass
|
try:
|
||||||
|
os.remove(join(expanduser('~'), '.wakatime.conf'))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
settings.set('api_key', api_key)
|
settings.set('api_key', api_key)
|
||||||
sublime.save_settings(SETTINGS)
|
sublime.save_settings(SETTINGS)
|
||||||
try:
|
|
||||||
os.remove(join(expanduser('~'), '.wakatime.conf'))
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
convert_config_to_sublime_settings()
|
convert_config_to_sublime_settings()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user