paths quality fixes

This commit is contained in:
lakshyacis 2019-10-22 19:53:38 +05:30
parent cacac00e21
commit 27be035e51
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
1 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,6 @@
"""
Path related functions
"""
import logging import logging
import os import os
import re import re
@ -41,7 +44,8 @@ def lookupAppdataFolder():
dataFolder = os.path.join( dataFolder = os.path.join(
os.environ['HOME'], os.environ['HOME'],
'Library/Application Support/', APPNAME 'Library/Application Support/', APPNAME
) + '/' # FIXME: should also be os.path.sep ) + '/'
except KeyError: except KeyError:
sys.exit( sys.exit(
'Could not find home folder, please report this message' 'Could not find home folder, please report this message'
@ -75,6 +79,7 @@ def codePath():
return os.path.dirname(__file__) return os.path.dirname(__file__)
return ( return (
os.environ.get('RESOURCEPATH') os.environ.get('RESOURCEPATH')
# pylint: disable=protected-access
if frozen == "macosx_app" else sys._MEIPASS) if frozen == "macosx_app" else sys._MEIPASS)
@ -91,7 +96,7 @@ def tail(f, lines=20):
# from the end of the file # from the end of the file
blocks = [] blocks = []
while lines_to_go > 0 and block_end_byte > 0: while lines_to_go > 0 and block_end_byte > 0:
if (block_end_byte - BLOCK_SIZE > 0): if block_end_byte - BLOCK_SIZE > 0:
# read the last block we haven't yet read # read the last block we haven't yet read
f.seek(block_number * BLOCK_SIZE, 2) f.seek(block_number * BLOCK_SIZE, 2)
blocks.append(f.read(BLOCK_SIZE)) blocks.append(f.read(BLOCK_SIZE))