Fix paths for os x

Fix paths to use binaries in the app bundle
This commit is contained in:
Jack 2015-12-20 03:29:13 -05:00
parent 9714985855
commit 0a7b2683ff
3 changed files with 18 additions and 3 deletions

View file

@ -1,3 +1,4 @@
import sys
from lbrynet.interfaces import IRequestCreator, IQueryHandlerFactory, IQueryHandler, ILBRYWallet from lbrynet.interfaces import IRequestCreator, IQueryHandlerFactory, IQueryHandler, ILBRYWallet
from lbrynet.core.client.ClientRequest import ClientRequest from lbrynet.core.client.ClientRequest import ClientRequest
from lbrynet.core.Error import UnknownNameError, InvalidStreamInfoError, RequestCanceledError from lbrynet.core.Error import UnknownNameError, InvalidStreamInfoError, RequestCanceledError
@ -372,6 +373,8 @@ class LBRYcrdWallet(object):
self.lbrycrdd = subprocess.Popen([self.lbrycrdd_path, "-datadir=%s" % self.wallet_dir, self.lbrycrdd = subprocess.Popen([self.lbrycrdd_path, "-datadir=%s" % self.wallet_dir,
"-conf=%s" % self.wallet_conf], startupinfo=si) "-conf=%s" % self.wallet_conf], startupinfo=si)
else: else:
if sys.platform == 'darwin':
os.chdir("/Applications/LBRY.app/Contents/Resources")
self.lbrycrdd = subprocess.Popen([self.lbrycrdd_path, "-datadir=%s" % self.wallet_dir, self.lbrycrdd = subprocess.Popen([self.lbrycrdd_path, "-datadir=%s" % self.wallet_dir,
"-conf=%s" % self.wallet_conf]) "-conf=%s" % self.wallet_conf])
self.started_lbrycrdd = True self.started_lbrycrdd = True

View file

@ -4,6 +4,7 @@ import os.path
import argparse import argparse
import requests import requests
import locale import locale
import sys
from yapsy.PluginManager import PluginManager from yapsy.PluginManager import PluginManager
from twisted.internet import defer, threads, stdio, task, error from twisted.internet import defer, threads, stdio, task, error
# from lbrynet.core.client.AutoDownloader import AutoFetcher # from lbrynet.core.client.AutoDownloader import AutoFetcher
@ -65,7 +66,10 @@ class LBRYConsole():
self.lbrycrd_conf = lbrycrd_conf self.lbrycrd_conf = lbrycrd_conf
self.lbrycrd_dir = lbrycrd_dir self.lbrycrd_dir = lbrycrd_dir
if not self.lbrycrd_dir: if not self.lbrycrd_dir:
self.lbrycrd_dir = os.path.join(os.path.expanduser("~"), ".lbrycrd") if sys.platform == "darwin":
self.lbrycrd_dir = os.path.join(os.path.expanduser("~"), "Library/Application Support/lbrycrd")
else:
self.lbrycrd_dir = os.path.join(os.path.expanduser("~"), ".lbrycrd")
if not self.lbrycrd_conf: if not self.lbrycrd_conf:
self.lbrycrd_conf = os.path.join(self.lbrycrd_dir, "lbrycrd.conf") self.lbrycrd_conf = os.path.join(self.lbrycrd_dir, "lbrycrd.conf")
# self.autofetcher_conf = os.path.join(self.lbrycrd_dir, "autofetcher.conf") # self.autofetcher_conf = os.path.join(self.lbrycrd_dir, "autofetcher.conf")

View file

@ -20,6 +20,7 @@ from lbrynet.lbryfile.client.LBRYFileOptions import add_lbry_file_to_sd_identifi
import os import os
import requests import requests
import shutil import shutil
import sys
from twisted.internet import threads, defer, task from twisted.internet import threads, defer, task
@ -42,8 +43,12 @@ class LBRYDownloader(object):
self.download_directory = get_path(FOLDERID.Downloads, UserHandle.current) self.download_directory = get_path(FOLDERID.Downloads, UserHandle.current)
self.wallet_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), "lbrycrd") self.wallet_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), "lbrycrd")
else: else:
self.download_directory = os.path.join(os.path.expanduser("~"), "Downloads") if sys.platform == 'darwin':
self.wallet_dir = os.path.join(os.path.expanduser("~"), ".lbrycrd") self.download_directory = os.path.join(os.path.expanduser("~"), "Downloads")
self.wallet_dir = os.path.join(os.path.expanduser("~"), "Library/Application Support/lbrycrd")
else:
self.download_directory = os.getcwd()
self.wallet_dir = os.path.join(os.path.expanduser("~"), ".lbrycrd")
self.wallet_conf = os.path.join(self.wallet_dir, "lbrycrd.conf") self.wallet_conf = os.path.join(self.wallet_dir, "lbrycrd.conf")
self.wallet_user = None self.wallet_user = None
self.wallet_password = None self.wallet_password = None
@ -297,6 +302,9 @@ class LBRYDownloader(object):
if not lbrycrdd_path: if not lbrycrdd_path:
lbrycrdd_path = self.default_lbrycrdd_path lbrycrdd_path = self.default_lbrycrdd_path
if sys.platform == 'darwin':
os.chdir("/Applications/LBRY.app/Contents/Resources")
wallet = LBRYcrdWallet(self.db_dir, wallet_dir=self.wallet_dir, wallet_conf=self.wallet_conf, wallet = LBRYcrdWallet(self.db_dir, wallet_dir=self.wallet_dir, wallet_conf=self.wallet_conf,
lbrycrdd_path=lbrycrdd_path) lbrycrdd_path=lbrycrdd_path)