Skip to content

Commit

Permalink
Don't use __file__
Browse files Browse the repository at this point in the history
  • Loading branch information
kubilus1 committed Jul 8, 2023
1 parent e8b7264 commit 2774ce4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
9 changes: 8 additions & 1 deletion autoortho/aoconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@
import configparser
import platform

import importlib.resources
import inspect

import logging
log = logging.getLogger(__name__)

import PySimpleGUI as sg

from . import downloader

CUR_PATH = os.path.dirname(os.path.realpath(__file__))
#from . import . as autoortho
#CUR_PATH = os.path.dirname(os.path.realpath(__file__))
#CUR_PATH = os.path.dirname(os.path.realpath('.'))
#CUR_PATH = str(importlib.resources.files(autoortho).joinpath(''))

CUR_PATH = os.path.dirname(inspect.getfile(downloader))

class SectionParser:
true = ['true','1', 'yes', 'on']
Expand Down
12 changes: 8 additions & 4 deletions autoortho/pydds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
from binascii import hexlify
from ctypes import *
#from PIL import Image
import inspect

from .aoimage import AoImage as Image
from .aoconfig import CFG
from . import downloader

import platform
import threading
Expand All @@ -21,15 +23,17 @@
import logging
log = logging.getLogger(__name__)

CUR_PATH = os.path.dirname(inspect.getfile(downloader))

#_stb = CDLL("/usr/lib/x86_64-linux-gnu/libstb.so")
if platform.system().lower() == 'linux':
print("Linux detected")
_stb_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'lib','linux','lib_stb_dxt.so')
_ispc_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'lib','linux','libispc_texcomp.so')
_stb_path = os.path.join(CUR_PATH,'lib','linux','lib_stb_dxt.so')
_ispc_path = os.path.join(CUR_PATH,'lib','linux','libispc_texcomp.so')
elif platform.system().lower() == 'windows':
print("Windows detected")
_stb_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'lib','windows','stb_dxt.dll')
_ispc_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'lib','windows','ispc_texcomp.dll')
_stb_path = os.path.join(CUR_PATH,'lib','windows','stb_dxt.dll')
_ispc_path = os.path.join(CUR_PATH,'lib','windows','ispc_texcomp.dll')
else:
print("System is not supported")
exit()
Expand Down

0 comments on commit 2774ce4

Please sign in to comment.