Skip to content

Commit

Permalink
Fix core library import path
Browse files Browse the repository at this point in the history
The gedit plugin working directory isn't documented, and as such can
change from version to version. This is the root cause of #9.

This changes the core library path to be computed based on the location
of shared.py, instead of assuming the plugin working directory. This
should finally allow the plugin to use the bundled core library instead
of having to install the library separately.
  • Loading branch information
jefferyto authored and xuhdev committed Nov 12, 2018
1 parent d034c32 commit fa44686
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions editorconfig_plugin/shared.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from os.path import abspath
import os
import sys
import logging

editorconfig_path = abspath('editorconfig-core-py/')
plugin_dir = os.path.dirname(__file__)
lib_dir = os.path.join(plugin_dir, '..', 'editorconfig-core-py')
editorconfig_path = os.path.abspath(lib_dir)
if editorconfig_path not in sys.path:
sys.path.append(editorconfig_path)

Expand Down

0 comments on commit fa44686

Please sign in to comment.