#!/usr/bin/env python3

import os, hashlib

filename = 'ls1config.xml'
correct_hash = '68661a6b130ef84f378cd7ab3a3f1e6e'
wrong_filename = 'ls1Config.xml'

try:
	# This reads filename relative to check_solution, not relative to current working dir
	path = os.path.join(os.path.dirname(__file__),filename)
	with open(path, 'rb') as file:
		result = hashlib.md5(file.read()).hexdigest()
		if result == correct_hash:
			print("Congratulations! Task solved correctly.")
		else:
			print("ERROR wrong file content, please double check.")
except FileNotFoundError:
	print("ERROR " + filename + " not found, double check path and file name.")

	path = os.path.join(os.path.dirname(__file__),wrong_filename)
	if os.path.exists(path):
		print("Note: Found \"" + wrong_filename + "\", it seems you forgot to rename the file.")
