2013-09-02 17:45:53 -04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
2014-01-13 14:08:43 -05:00
|
|
|
# Copyright (C) 2013 Google Inc.
|
2013-09-02 17:45:53 -04:00
|
|
|
#
|
|
|
|
# This file is part of YouCompleteMe.
|
|
|
|
#
|
|
|
|
# YouCompleteMe is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# YouCompleteMe is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2013-09-20 20:24:34 -04:00
|
|
|
import json
|
|
|
|
import os
|
2013-10-04 16:00:55 -04:00
|
|
|
from frozendict import frozendict
|
2013-09-02 17:45:53 -04:00
|
|
|
|
|
|
|
_USER_OPTIONS = {}
|
|
|
|
|
|
|
|
def SetAll( new_options ):
|
|
|
|
global _USER_OPTIONS
|
|
|
|
_USER_OPTIONS = frozendict( new_options )
|
|
|
|
|
|
|
|
|
|
|
|
def GetAll():
|
|
|
|
return _USER_OPTIONS
|
|
|
|
|
|
|
|
|
|
|
|
def Value( key ):
|
|
|
|
return _USER_OPTIONS[ key ]
|
2013-09-20 20:24:34 -04:00
|
|
|
|
|
|
|
|
|
|
|
def LoadDefaults():
|
2013-10-04 15:23:33 -04:00
|
|
|
SetAll( DefaultOptions() )
|
2013-09-20 20:24:34 -04:00
|
|
|
|
|
|
|
|
2013-10-04 15:23:33 -04:00
|
|
|
def DefaultOptions():
|
2013-09-20 20:24:34 -04:00
|
|
|
settings_path = os.path.join(
|
|
|
|
os.path.dirname( os.path.abspath( __file__ ) ),
|
|
|
|
'server/default_settings.json' )
|
|
|
|
with open( settings_path ) as f:
|
|
|
|
return json.loads( f.read() )
|
|
|
|
|