From a1decb8e24bdde1113f11381916bae68cefe6199 Mon Sep 17 00:00:00 2001 From: Jiye Qian Date: Mon, 14 Aug 2017 02:29:03 +0800 Subject: [PATCH] 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. --- libs/settings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/settings.py b/libs/settings.py index 3efe5d53..fa3a5487 100644 --- a/libs/settings.py +++ b/libs/settings.py @@ -1,10 +1,11 @@ import pickle import os +import sys class Settings(object): def __init__(self): self.data = {} - self.path = '.settings.pkl' + self.path = os.path.join(os.path.dirname(sys.argv[0]), '.settings.pkl') def __setitem__(self, key, value): self.data[key] = value