Use gramps.gen.const.HOME_DIR instead of os.environ['HOME']
$HOME doesn't exist on Windows, so os.environ['HOME'] gives the wrong answer.
This commit is contained in:
parent
71650917bf
commit
53c878aa08
@ -32,7 +32,7 @@ This is used since Gramps version 3.0
|
|||||||
# Standard python modules
|
# Standard python modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from __future__ import print_function, with_statement
|
from __future__ import print_function, with_statement, unicode_literals
|
||||||
import sys
|
import sys
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
@ -90,7 +90,7 @@ from ..updatecallback import UpdateCallback
|
|||||||
from ..errors import DbError
|
from ..errors import DbError
|
||||||
from ..constfunc import (win, conv_to_unicode, cuni, UNITYPE, handle2internal,
|
from ..constfunc import (win, conv_to_unicode, cuni, UNITYPE, handle2internal,
|
||||||
get_env_var)
|
get_env_var)
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import HOME_DIR, GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
|
|
||||||
_LOG = logging.getLogger(DBLOGNAME)
|
_LOG = logging.getLogger(DBLOGNAME)
|
||||||
@ -2474,7 +2474,7 @@ def write_lock_file(name):
|
|||||||
try:
|
try:
|
||||||
user = os.getlogin()
|
user = os.getlogin()
|
||||||
except:
|
except:
|
||||||
user = get_env_var('USER')
|
user = os.environ['USER'] #not win, don't need get_env_var
|
||||||
if host:
|
if host:
|
||||||
text = "%s@%s" % (user, host)
|
text = "%s@%s" % (user, host)
|
||||||
else:
|
else:
|
||||||
@ -2500,7 +2500,7 @@ if __name__ == "__main__":
|
|||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
db_name = sys.argv[1]
|
db_name = sys.argv[1]
|
||||||
else:
|
else:
|
||||||
db_home = os.path.join(os.environ['HOME'], '.gramps','grampsdb')
|
db_home = os.path.join(HOME_DIR,'grampsdb')
|
||||||
for dir in os.listdir(db_home):
|
for dir in os.listdir(db_home):
|
||||||
db_path = os.path.join(db_home, dir)
|
db_path = os.path.join(db_home, dir)
|
||||||
db_fn = os.path.join(db_path, 'name.txt')
|
db_fn = os.path.join(db_path, 'name.txt')
|
||||||
|
@ -1407,7 +1407,7 @@ class GrampsPreferences(ConfigureDialog):
|
|||||||
Gtk.ResponseType.OK))
|
Gtk.ResponseType.OK))
|
||||||
dbpath = config.get('behavior.database-path')
|
dbpath = config.get('behavior.database-path')
|
||||||
if not dbpath:
|
if not dbpath:
|
||||||
dbpath = os.path.join(os.environ['HOME'], '.gramps','grampsdb')
|
dbpath = os.path.join(HOME_DIR,'grampsdb')
|
||||||
f.set_current_folder(os.path.dirname(dbpath))
|
f.set_current_folder(os.path.dirname(dbpath))
|
||||||
|
|
||||||
status = f.run()
|
status = f.run()
|
||||||
|
Loading…
Reference in New Issue
Block a user