Enhance compatibility

Adding the path to '.settings.pkl' file, this is especailly useful for MacOS. Then we can put '.settings.pkl' into 'MacOS' folder within 'labelImg.app'. The App will crash without path setting, as soon as we close the App in MacOS.
This commit is contained in:
Jiye Qian 2017-08-14 02:29:03 +08:00
parent 6222214ff3
commit a1decb8e24

View File

@ -1,10 +1,11 @@
import pickle import pickle
import os import os
import sys
class Settings(object): class Settings(object):
def __init__(self): def __init__(self):
self.data = {} self.data = {}
self.path = '.settings.pkl' self.path = os.path.join(os.path.dirname(sys.argv[0]), '.settings.pkl')
def __setitem__(self, key, value): def __setitem__(self, key, value):
self.data[key] = value self.data[key] = value