2 """deterfile.py - determine file type"""
13 determine given file's type.
14 This function returns strings.
16 @param path: filepath you want to determine
19 if not os.path.isfile(path):
20 return ("file not exist.",)
22 cmd = _file_cmd % path
23 escaped_path = path.replace("\\", "\\\\");
24 stdout = os.popen(cmd, "r")
27 if re.search(r"^%s:" % escaped_path, line):
28 line = re.sub(r"^%s:\s*" % escaped_path, "", line)
29 tpl = line.strip().split(",")
30 results.extend([x.strip() for x in tpl])