Exemplo n.º 1
0
def find_config(filename='netic.sca'):
    '''
        Find path to the Scala config folder.  Handles mmos.ini root data
        folder modifications.
        Options:
            filename        Filename to join with with config folder, or '' for
                            bare folder.
        Returns:
            Path string with optional filename attached.
            None on error.
    '''
    import ConfigParser as cp
    netic_path = None
    try:  # mmos.ini first
        mmosini = st.get_ini(hint='player')  # throws AttributeError if st 1.00
        rootf = mmosini.get('WIN32_RootDataFolder'.lower()).replace('"', '')
        if rootf:
            netic_path = join(rootf, 'Application Data', 'Config', filename)
        else:
            raise AttributeError
    except (AttributeError, ImportError, cp.ParsingError):
        # look in All Users/Application Data
        appdataf = shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_APPDATA, 0,
                                         0)
        netic_path = join(appdataf, 'Scala', 'InfoChannel Player 5', 'Config',
                          filename)

    if not os.access(os.path.dirname(netic_path), os.W_OK):
        _log.critical('Not able to write netic.sca at "%s".' % netic_path)
        netic_path = None
    _log.debug('netic_path: "%s"', netic_path)
    return netic_path
Exemplo n.º 2
0
def find_config(filename='netic.sca'):
    '''
        Find path to the Scala config folder.  Handles mmos.ini root data
        folder modifications.
        Options:
            filename        Filename to join with with config folder, or '' for
                            bare folder.
        Returns:
            Path string with optional filename attached.
            None on error.
    '''
    import ConfigParser as cp
    netic_path = None
    try:  # mmos.ini first
        mmosini = st.get_ini(hint='player')     # throws AttributeError if st 1.00
        rootf = mmosini.get('WIN32_RootDataFolder'.lower()).replace('"','')
        if rootf:
            netic_path = join(rootf, 'Application Data', 'Config', filename)
        else:       raise AttributeError
    except (AttributeError, ImportError, cp.ParsingError):
        # look in All Users/Application Data
        appdataf = shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_APPDATA, 0, 0)
        netic_path =  join(appdataf, 'Scala', 'InfoChannel Player 5', 'Config',
            filename)

    if not os.access(os.path.dirname(netic_path), os.W_OK):
        _log.critical('Not able to write netic.sca at "%s".' % netic_path)
        netic_path = None
    _log.debug('netic_path: "%s"', netic_path)
    return netic_path
Exemplo n.º 3
0
import scalalib
import scalatools as st
svars = scalalib.sharedvars()

svars.results = str(st.get_ini(svars.filepath, svars.ini_section))
Exemplo n.º 4
0
import scalalib
import scalatools as st
svars = scalalib.sharedvars()

svars.results = str( st.get_ini(svars.filepath, svars.ini_section) )