different OS

This commit is contained in:
Андрей Владимирович 2016-02-16 23:10:34 +03:00
parent 72cca0b327
commit bd0c264fdd
1 changed files with 5 additions and 9 deletions

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from ctypes import * from ctypes import *
from settings import Settings from settings import Settings
import os from platform import system
class ToxOptions(Structure): class ToxOptions(Structure):
@ -30,12 +30,10 @@ class Tox(object):
data = fl.read() data = fl.read()
size = len(data) size = len(data)
print size print size
# TODO: different names for different OS if system() == 'Linux':
temp = os.path.abspath(__file__) self.libtoxcore = CDLL('libs/libtoxcore.so')
temp = os.path.realpath(temp) elif system() == 'Windows':
temp = os.path.dirname(temp) + '/libs/' self.libtoxcore = CDLL('libs/libtox.dll')
os.chdir(temp)
self.libtoxcore = CDLL(temp + 'libtoxcore.so')
print self.libtoxcore.__dict__ print self.libtoxcore.__dict__
self.libtoxcore.tox_options_new.restype = POINTER(ToxOptions) self.libtoxcore.tox_options_new.restype = POINTER(ToxOptions)
# TODO: load from settings # TODO: load from settings
@ -49,5 +47,3 @@ class Tox(object):
if __name__ == "__main__": if __name__ == "__main__":
t = Tox('tox_save') t = Tox('tox_save')