Exemplo n.º 1
0
def ext_main_file(install=False):
	src_dir = ext_pkg_path()

	def ext_fn():
		l = sorted(glob.glob('%s/*.go' % src_dir))
		return l[0] if l else ''

	fn = ext_fn()
	if fn or not install:
		return fn

	try:
		gs.mkdirp(src_dir)
		with open('%s/gosublime.go' % src_dir, 'x') as f:
			f.write(DEFAULT_EXT_SRC)
	except FileExistsError:
		pass
	except Exception:
		gs.error_traceback(DOMAIN, status_txt='Cannot create default extension package')

	return ext_fn()
Exemplo n.º 2
0
def ext_main_file(install=False):
    src_dir = ext_pkg_path()

    def ext_fn():
        l = sorted(glob.glob('%s/*.go' % src_dir))
        return l[0] if l else ''

    fn = ext_fn()
    if fn or not install:
        return fn

    try:
        gs.mkdirp(src_dir)
        with open('%s/gosublime.go' % src_dir, 'x') as f:
            f.write(DEFAULT_EXT_SRC)
    except FileExistsError:
        pass
    except Exception:
        gs.error_traceback(
            DOMAIN, status_txt='Cannot create default extension package')

    return ext_fn()