mirror of
https://git.zavage.net/Zavage-Software/smileyface.git
synced 2026-06-25 18:12:48 -06:00
19 lines
361 B
Python
19 lines
361 B
Python
import hashlib
|
|
import os
|
|
|
|
|
|
def ensure_dir_exists(dirpath):
|
|
if dirpath is None:
|
|
return
|
|
if dirpath == "":
|
|
return
|
|
dirpath = os.path.dirname(dirpath)
|
|
os.makedirs(dirpath, exist_ok=True)
|
|
|
|
|
|
def md5_file(filename):
|
|
with open(filename, "rb") as fp:
|
|
data = fp.read()
|
|
h = hashlib.md5(data).hexdigest()
|
|
return h
|