@@ -64,19 +64,18 @@ def get_path_to_1c():
6464 cmd = os .getenv ("PATH1C" )
6565 if not cmd is None :
6666 cmd = os .path .join (cmd , "1cv8" )
67- maxversion = max (list (filter ((lambda x : '8.' in x ), os .listdir (cmd ))))
67+ maxversion = max (list (filter ((lambda x : '8.' in x ), os .listdir (cmd ))))
6868 if maxversion is None :
6969 raise Exception ("not found verion dirs" )
70- cmd = os .path .join (cmd , maxversion + os .path .sep + "bin" + os .path .sep + "1cv8.exe" )
70+ cmd = os .path .join (cmd , maxversion + os .path .sep + "bin" + os .path .sep + "1cv8.exe" )
7171
7272 if not os .path .isfile (cmd ):
73- raise Exception ("file not found %s" % (cmd ))
73+ raise Exception ("file not found %s" % (cmd ))
7474
7575 return cmd
7676
7777 #read config
7878
79-
8079 curdir = os .curdir
8180 if '__file__' in globals ():
8281 curdir = os .path .dirname (os .path .abspath (__file__ ))
@@ -96,13 +95,13 @@ def get_path_to_1c():
9695 if program_files is None :
9796 raise "path to Program files not found" ;
9897 cmd = os .path .join (program_files , "1cv8" )
99- maxversion = max (list (filter ((lambda x : '8.' in x ), os .listdir (cmd ))))
98+ maxversion = max (list (filter ((lambda x : '8.' in x ), os .listdir (cmd ))))
10099 if maxversion is None :
101100 raise Exception ("not found verion dirs" )
102101 cmd = os .path .join (cmd , maxversion + os .path .sep + "bin" + os .path .sep + "1cv8.exe" )
103102
104103 if not os .path .isfile (cmd ):
105- raise Exception ("file not found %s" % (cmd ))
104+ raise Exception ("file not found %s" % (cmd ))
106105
107106 else :
108107 cmd = subprocess .Popen (["which" , "1cv8" ], stdout = PIPE ).communicate ()[0 ].strip ()
@@ -175,12 +174,15 @@ def decompile(list_of_files, source=None, platform=None):
175174 if not os .path .exists (dirsource ):
176175 os .makedirs (dirsource )
177176 #для каждого файла определим новую папку.
177+ logging .debug ("{} {} {}" .format (dirsource , newdirname , basename ))
178178 newsourcepath = os .path .join (dirsource , newdirname , basename )
179179 if (os .path .isabs (newdirname )):
180180 newsourcepath = os .path .join (dirsource , basename )
181181 if not os .path .exists (newsourcepath ):
182182 logging .debug ("create new dir %s" % newsourcepath )
183183 os .makedirs (newsourcepath )
184+ else :
185+ shutil .rmtree (newsourcepath , ignore_errors = True )
184186
185187 logging .debug ("file to copy %s, new path %s, new file %s"
186188 % (filename , newsourcepath , os .path .join (newsourcepath , fullbasename ))
@@ -323,6 +325,19 @@ def main():
323325 if args .inputPath is not None :
324326 files = [os .path .abspath (
325327 os .path .join (os .path .curdir , args .inputPath ))]
328+ if os .path .isdir (files [0 ]):
329+ rootDir = os .path .abspath (
330+ os .path .join (os .path .curdir , args .inputPath ));
331+ files = []
332+ for dirName , subdirList , fileList in os .walk (rootDir ):
333+ absdir = dirName [len (rootDir )+ 1 :]
334+ if '.git' in subdirList :
335+ subdirList .remove ('.git' )
336+ if 'src' in subdirList :
337+ subdirList .remove ('src' )
338+ for fname in fileList :
339+ files .append (os .path .join (absdir ,fname ))
340+
326341 decompile (
327342 files , args .output , args .platform )
328343
0 commit comments