Skip to content

Commit 2859ed6

Browse files
committed
Same for namecoin.lookupNamecoinFolder()
1 parent e15d4ed commit 2859ed6

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/namecoin.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -274,23 +274,23 @@ def lookupNamecoinFolder():
274274
.. todo:: Check whether this works on other platforms as well!
275275
"""
276276

277-
app = "namecoin"
278-
from os import path, environ
277+
APPNAME = "namecoin"
279278
if sys.platform == "darwin":
280-
if "HOME" in environ:
281-
dataFolder = path.join(os.environ["HOME"],
282-
"Library/Application Support/", app) + '/'
283-
else:
284-
print(
279+
try:
280+
dataFolder = os.path.join(
281+
os.environ['HOME'],
282+
"Library/Application Support/", APPNAME) + '/'
283+
except KeyError:
284+
sys.exit(
285285
"Could not find home folder, please report this message"
286-
" and your OS X version to the BitMessage Github."
287-
)
288-
sys.exit()
289-
290-
elif "win32" in sys.platform or "win64" in sys.platform:
291-
dataFolder = path.join(environ["APPDATA"], app) + "\\"
286+
" and your OS X version to the BitMessage Github.")
287+
elif sys.platform.startswith('win'):
288+
dataFolder = os.path.join(
289+
os.environ['APPDATA'], APPNAME
290+
).decode(sys.getfilesystemencoding(), 'ignore') + os.path.sep
292291
else:
293-
dataFolder = path.join(environ["HOME"], ".%s" % app) + "/"
292+
dataFolder = os.path.join(
293+
os.environ['HOME'], ".%s" % APPNAME) + os.path.sep
294294

295295
return dataFolder
296296

0 commit comments

Comments
 (0)