Skip to content

Commit 38726e1

Browse files
geatecaramperes
andcommitted
Output dir made configurable
Co-authored-by: momothereal <[email protected]>
1 parent fd1ed49 commit 38726e1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

transcrypt/modules/org/transcrypt/compiler.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,13 @@ def __init__ (
7575
self.sourceDir = '/'.join (self.sourcePrepath.split ('/') [ : -1])
7676
self.mainModuleName = self.sourcePrepath.split ('/') [-1]
7777

78-
79-
self.targetDir = f'{self.sourceDir}/__target__'.replace ('\\', '/')
78+
if utils.commandArgs.outdir:
79+
if os.path.isabs (utils.commandArgs.outdir):
80+
self.targetDir = utils.commandArgs.outdir.replace ('\\', '/')
81+
else:
82+
self.targetDir = f'{self.sourceDir}/{utils.commandArgs.outdir}'.replace ('\\', '/')
83+
else:
84+
self.targetDir = f'{self.sourceDir}/__target__'.replace ('\\', '/')
8085

8186
self.projectPath = f'{self.targetDir}/{self.mainModuleName}.project'
8287

transcrypt/modules/org/transcrypt/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def parse (self):
6565
self.argParser.add_argument ('-m', '--map', help = "generate source map", action = 'store_true')
6666
self.argParser.add_argument ('-n', '--nomin', help = "no minification", action = 'store_true')
6767
self.argParser.add_argument ('-o', '--opov', help = "enable operator overloading by default. In general this is disadvised, use __pragma__ ('opov') and __pragma__('noopov') locally instead to prevent slow code", action = 'store_true')
68+
self.argParser.add_argument ('-od', '--outdir', help = 'override output directory (default = __target__)')
6869
self.argParser.add_argument ('-p', '--parent', nargs = '?', help = "object that will hold application, default is window. Use -p .none to generate orphan application, e.g. for use in node.js")
6970
self.argParser.add_argument ('-r', '--run', help = "run source file rather than compiling it", action = 'store_true')
7071
self.argParser.add_argument ('-s', '--symbols', nargs ='?', help = "names, joined by $, separately passed to main module in __symbols__ variable")

0 commit comments

Comments
 (0)