Skip to content

Commit d319c2f

Browse files
Robert M OchshornRobert M Ochshorn
authored andcommitted
fallback on .gentle for get_resourcepath
1 parent 5c8340c commit d319c2f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

gentle/paths.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@ def get_binary(name):
1111
elif os.path.exists(name):
1212
binpath = "./%s" % (name)
1313

14-
logging.info("binpath %s", binpath)
14+
logging.debug("binpath %s", binpath)
1515
return binpath
1616

1717
def get_resource(path):
1818
rpath = path
1919
if hasattr(sys, "frozen"):
2020
rpath = os.path.abspath(os.path.join(sys._MEIPASS, '..', 'Resources', path))
21-
logging.info("resourcepath %s", rpath)
21+
if not os.path.exists(rpath):
22+
# DMG may be read-only; fall-back to datadir (ie. so language models can be added)
23+
rpath = get_datadir(path)
24+
logging.debug("resourcepath %s", rpath)
2225
return rpath
2326

2427
def get_datadir(path):
2528
datadir = path
2629
if hasattr(sys, "frozen"):# and sys.frozen == "macosx_app":
2730
datadir = os.path.join(os.environ['HOME'], '.gentle', path)
28-
logging.info("datadir %s", datadir)
31+
logging.debug("datadir %s", datadir)
2932
return datadir

0 commit comments

Comments
 (0)