1
1
#!/usr/bin/env python3
2
2
# -*- coding: utf-8 -*-
3
- PROG_VERSION = "Time-stamp: <2018-08-31 19:37:34 vk>"
3
+ PROG_VERSION = "Time-stamp: <2019-12-22 13:23:52 vk>"
4
4
5
5
# TODO:
6
6
# - fix parts marked with «FIXXME»
@@ -38,7 +38,6 @@ def save_import(library):
38
38
"\" .\n Please install it, e.g., with \" sudo pip install " + library + "\" ." )
39
39
sys .exit (2 )
40
40
41
-
42
41
import re
43
42
import sys
44
43
import os
@@ -60,7 +59,8 @@ def save_import(library):
60
59
except ImportError :
61
60
print ("Could not find Python module \" win32com.client\" .\n Please install it, e.g., " +
62
61
"with \" sudo pip install pypiwin32\" ." )
63
- sys .exit (2 )
62
+ sys .exit (3 )
63
+ save_import ('pathlib' )
64
64
65
65
PROG_VERSION_DATE = PROG_VERSION [13 :23 ]
66
66
# unused: INVOCATION_TIME = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime())
@@ -2468,6 +2468,22 @@ def main():
2468
2468
2469
2469
files = extract_filenames_from_argument (options .files )
2470
2470
2471
+ if platform .system () == 'Windows' and len (files )== 1 :
2472
+ # Windows CLI does not resolve wildcard globbing: https://github.com/novoid/filetags/issues/25
2473
+ # Therefore, filetags has to do the business proper(TM) operating systems usually
2474
+ # does: converting file globs to lists of files:
2475
+
2476
+ #logging.debug("WINDOWS: files[0] RAW [%s]" % str(files[0]))
2477
+ path = pathlib .Path (files [0 ]).expanduser ()
2478
+ parts = path .parts [1 :] if path .is_absolute () else path .parts
2479
+ expandedfiles = pathlib .Path (path .root ).glob (str (pathlib .Path ("" ).joinpath (* parts )))
2480
+ files = []
2481
+ for file in expandedfiles :
2482
+ #logging.debug("WINDOWS: file within expandedfiles [%s]" % str(file))
2483
+ files .append (str (file ))
2484
+ logging .debug ("WINDOWS: len(files) [%s]" % str (len (files )))
2485
+ logging .debug ("WINDOWS: files CONVERTED [%s]" % str (files ))
2486
+
2471
2487
global list_of_link_directories
2472
2488
global chosen_tagtrees_dir
2473
2489
0 commit comments