mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-07 20:54:22 +00:00
Fix invalid flag for file on Windows
This commit is contained in:
@@ -9,6 +9,7 @@ import os
|
|||||||
import io
|
import io
|
||||||
import re
|
import re
|
||||||
import mmap
|
import mmap
|
||||||
|
import sys
|
||||||
from jinja2 import Environment, FileSystemLoader, \
|
from jinja2 import Environment, FileSystemLoader, \
|
||||||
ChoiceLoader, FunctionLoader, TemplateNotFound, \
|
ChoiceLoader, FunctionLoader, TemplateNotFound, \
|
||||||
StrictUndefined
|
StrictUndefined
|
||||||
@@ -192,7 +193,13 @@ class Templategen:
|
|||||||
self.log.dbg('using \"magic\" for filetype identification')
|
self.log.dbg('using \"magic\" for filetype identification')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# fallback
|
# 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)
|
debug=self.debug)
|
||||||
self.log.dbg('using \"file\" for filetype identification')
|
self.log.dbg('using \"file\" for filetype identification')
|
||||||
filetype = filetype.strip()
|
filetype = filetype.strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user