exec-notify/execNotifyDir/util.py

16 lines
302 B
Python
Raw Normal View History

2020-12-06 16:40:03 +01:00
import os
2020-12-06 13:18:32 +01:00
from pathlib import Path
2020-12-06 16:40:03 +01:00
def getProjectBase() -> Path:
return Path(os.path.realpath(__file__)).parent.parent
2020-12-06 13:18:32 +01:00
def readFirstLine(file: Path) -> str:
"""
:param file: Path to file
:return: first line of file
"""
with open(file, "r") as f:
return f.readline()