1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 14:31:46 +00:00

Fix invalid flag for file on Windows

This commit is contained in:
Mo Hyun
2024-10-22 09:00:01 -07:00
committed by deadc0de
parent ef88de72c0
commit dc0db530e1

View File

@@ -9,6 +9,7 @@ import os
import io
import re
import mmap
import sys
from jinja2 import Environment, FileSystemLoader, \
ChoiceLoader, FunctionLoader, TemplateNotFound, \
StrictUndefined
@@ -192,7 +193,13 @@ class Templategen:
self.log.dbg('using \"magic\" for filetype identification')
except ImportError:
# fallback
_, filetype = utils.run(['file', '-L', '-b', '--mime-type', src],
# `file` on Windows doesn't support `-L`
follow_symlink = ['-L'] if sys.platform != 'win32' else []
_, filetype = utils.run(['file'] + follow_symlink + ['-b',
'--mime-type',
src],
debug=self.debug)
self.log.dbg('using \"file\" for filetype identification')
filetype = filetype.strip()