Skip to content

Commit

Permalink
Merge pull request #4 from jmbeach/windows
Browse files Browse the repository at this point in the history
Merge windows binaries fix.
  • Loading branch information
ValentinSchmitz authored Oct 10, 2023
2 parents cf5b84a + f1d91d7 commit 6238cfb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import os

BASE_URL_DICTIONARIES = "https://api.github.com/repos/wooorm/dictionaries/contents"
URL_BINARIES = "https://github.com/jankelemen/convert-dict-tool-from-chromium/archive/refs/heads/master.zip"
URL_BINARIES = "https://github.com/jankelemen/convert-dict-tool-from-chromium/archive/refs/heads/master.zip"\
if os.name != 'nt' else 'https://github.com/jmbeach/convert_dict_windows/archive/refs/heads/main.zip'
VERSION_DICTIONARIES = "2a5353f1617f00e606dc036cab1c37df94272ca0"
URL_DICTIONARIES = lambda path: f"{BASE_URL_DICTIONARIES}/{path}?ref={VERSION_DICTIONARIES}"

Expand All @@ -14,7 +15,7 @@
ENABLED_PATH = os.path.join(USER_PATH, "enabled.pck")
USER_DICT_PATH = os.path.join(USER_PATH, "user_dics")
BINS_PATH = os.path.join(ADDON_PATH, "convert_dict")
BIN_PATH = os.path.join(ADDON_PATH, "convert_dict", "convert_dict")
BIN_PATH = os.path.join(ADDON_PATH, "convert_dict", "convert_dict" if os.name != 'nt' else "convert_dict.exe")
PERSONAL_PATH = os.path.join(USER_PATH, "user_dics", "personal.txt")

try:
Expand Down
9 changes: 5 additions & 4 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ def checkConversionBinaries(*args):


def compileBDIC(path, name, remove=False):
command = [BIN_PATH + " " + os.path.join(path, name)]
mode = os.stat(BIN_PATH).st_mode
mode |= (mode & 0o444) >> 2 # copy R bits to X
os.chmod(BIN_PATH, mode)
command = [BIN_PATH, os.path.join(path, name)]
if os.name != 'nt':
mode = os.stat(BIN_PATH).st_mode
mode |= (mode & 0o444) >> 2 # copy R bits to X
os.chmod(BIN_PATH, mode)
res = subprocess.run(command, shell=True, capture_output=True, text=True)
if remove:
ex = [".dic", ".aff"]
Expand Down

0 comments on commit 6238cfb

Please sign in to comment.