1010 output Output directory relative to current
1111
1212options:
13- -h, --help show this help message and exit
14- -e, --extended Include unimplemented substitutions, don't use in production
15- -t , --tiny Exclude classes directory
13+ -h, --help Show this help message and exit
14+ -e, --extended Include unimplemented substitutions, don't use in production
15+ -x , --exclude-classes Exclude classes directory
1616 -v, --verbose
1717
1818Will replace specific godot strings with redot. It tries to ignore external projects and other things that shouldn't
@@ -288,6 +288,14 @@ def convertFile(root, filename, outputDirectory, includeUnimplemented, verbose):
288288 with open (outputName , mode = 'w' , encoding = encoding ) as output :
289289 output .write (data )
290290
291+ def includeFile (root , filename , outputDirectory , verbose ):
292+ inputName = os .path .join (root , filename )
293+ outputName = os .path .join ('.' , outputDirectory , root , filename )
294+ ensureDirExists (outputName )
295+
296+ if verbose : print (f'Copying "{ inputName } " to "{ outputName } "' )
297+ shutil .copyfile (inputName , outputName )
298+
291299def copyGlobalDir (inputDirectory , inputMask , outputDirectory , verbose ):
292300 for root , dirs , files in os .walk (inputDirectory ):
293301 if (inputMask in root and outputDirectory not in root ):
@@ -314,10 +322,13 @@ def migrate(inputDirectory, outputDirectory, includeUnimplemented, ignoreClasses
314322 if (root .startswith (outputsig )):
315323 continue
316324
325+ items = filter (is_target , files )
326+
317327 if (ignoreClasses and 'classes' in root ):
328+ for item in items :
329+ includeFile (root , item , outputDirectory , verbose )
318330 continue
319331
320- items = filter (is_target , files )
321332 for item in items :
322333 convertFile (root , item , outputDirectory , includeUnimplemented , verbose )
323334
@@ -335,8 +346,8 @@ def main():
335346
336347 parser .add_argument ('input' , help = 'Input directory relative to current' )
337348 parser .add_argument ('output' , help = 'Output directory relative to current' )
338- parser .add_argument ('-e' , '--extended' , action = 'store_true' , help = 'Include unimplemented substitutions, don\' t use in production' )
339- parser .add_argument ('-t ' , '--tiny ' , action = 'store_true' , help = 'Exclude classes directory' )
349+ parser .add_argument ('-e' , '--extended' , default = defaultIncludeUnimplemented , help = 'Include unimplemented substitutions, don\' t use in production' )
350+ parser .add_argument ('-x ' , '--exclude-classes ' , default = ignoreClasses , help = 'Exclude classes directory' )
340351 parser .add_argument ('-v' , '--verbose' , action = 'store_true' )
341352
342353 args = parser .parse_args ()
@@ -352,7 +363,7 @@ def main():
352363 print ("output can't be . or start with /" )
353364 exit (1 )
354365 includeUnimplemented = args .extended
355- ignoreClasses = args .tiny
366+ ignoreClasses = args .exclude_classes
356367
357368 if (os .path .exists (outputDir )):
358369 print (f"Deleting { outputDir } " )
0 commit comments