From bd0c264fdd1b0e4fdbf5e5e1ddeebf5f6ec99567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=92=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Feb 2016 23:10:34 +0300 Subject: [PATCH] different OS --- src/tox.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/tox.py b/src/tox.py index 33e5593..ad2c4f5 100644 --- a/src/tox.py +++ b/src/tox.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from ctypes import * from settings import Settings -import os +from platform import system class ToxOptions(Structure): @@ -30,12 +30,10 @@ class Tox(object): data = fl.read() size = len(data) print size - # TODO: different names for different OS - temp = os.path.abspath(__file__) - temp = os.path.realpath(temp) - temp = os.path.dirname(temp) + '/libs/' - os.chdir(temp) - self.libtoxcore = CDLL(temp + 'libtoxcore.so') + if system() == 'Linux': + self.libtoxcore = CDLL('libs/libtoxcore.so') + elif system() == 'Windows': + self.libtoxcore = CDLL('libs/libtox.dll') print self.libtoxcore.__dict__ self.libtoxcore.tox_options_new.restype = POINTER(ToxOptions) # TODO: load from settings @@ -49,5 +47,3 @@ class Tox(object): if __name__ == "__main__": t = Tox('tox_save') - -