Skip to content
Snippets Groups Projects
Commit 20fd0910 authored by prndev's avatar prndev
Browse files

Added batch file for running embed_favicon on Windows.

Closes #246.
parent d58e7e77
No related branches found
No related tags found
1 merge request!2470Added batch file for running embed_favicon on Windows.
@echo off
pushd %~dp0
embed_favicon.py
popd
pause
...@@ -56,6 +56,7 @@ if __name__ == "__main__": ...@@ -56,6 +56,7 @@ if __name__ == "__main__":
size_from_filename = re.compile(r'([0-9]+)\....$') size_from_filename = re.compile(r'([0-9]+)\....$')
favicons_html = [] favicons_html = []
for fp in favicons_paths: for fp in favicons_paths:
print('Found favicon source file "%s".'%(fp))
# get mimetype by file extension # get mimetype by file extension
mimetype = ext2mimetype[fp[-4:]] mimetype = ext2mimetype[fp[-4:]]
if (mimetype == 'image/x-icon'): if (mimetype == 'image/x-icon'):
...@@ -74,7 +75,8 @@ if __name__ == "__main__": ...@@ -74,7 +75,8 @@ if __name__ == "__main__":
) )
# modify header file # modify header file
with open(header_html_path,'r+') as hf: with open(header_html_path,'r+',encoding='utf-8') as hf:
print('Rewriting "%s"...'%(header_html_path))
lines_in = hf.readlines() # read whole file lines_in = hf.readlines() # read whole file
lines_out = [] lines_out = []
for line in lines_in: for line in lines_in:
...@@ -87,3 +89,5 @@ if __name__ == "__main__": ...@@ -87,3 +89,5 @@ if __name__ == "__main__":
hf.seek(0) # move to beginning of file hf.seek(0) # move to beginning of file
hf.write(''.join(lines_out)) # overwrite with new data hf.write(''.join(lines_out)) # overwrite with new data
hf.truncate() # remove trailing old data hf.truncate() # remove trailing old data
print('Finished.')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment