
import glob
import os

uglifyjs = os.path.abspath("../lib/uglifyjs")
input_dir = os.path.abspath("./Resources/Tracker/scripts")
output_dir = os.path.abspath("./Resources/Tracker/scripts.min")

for file in glob.glob(input_dir + "/*.js"):
    name = os.path.basename(file)
    print("Minifying {0}...".format(name))
    os.system("{0} {1} -o {2}/{3}".format(uglifyjs, file, output_dir, name))

print("Done!")


import glob
import os
import shutil
import sys

if os.name == "nt":
    uglifyjs = os.path.abspath("../lib/uglifyjs.cmd")
else:
    uglifyjs = "uglifyjs"

if shutil.which(uglifyjs) is None:
    print("Cannot find executable: {0}".format(uglifyjs))
    sys.exit(1)

input_dir = os.path.abspath("./Resources/Tracker/scripts")
output_dir = os.path.abspath("./Resources/Tracker/scripts.min")

for file in glob.glob(input_dir + "/*.js"):
    name = os.path.basename(file)
    print("Minifying {0}...".format(name))
    os.system("{0} {1} -o {2}/{3}".format(uglifyjs, file, output_dir, name))

print("Done!")

Fix app minification script on non-Windows systems
Fix app minification script on non-Windows systems

  
  import glob
  import os
+ import shutil
+ import sys
  
+ if os.name == "nt":
- uglifyjs = os.path.abspath("../lib/uglifyjs")
+     uglifyjs = os.path.abspath("../lib/uglifyjs.cmd")
+ else:
+     uglifyjs = "uglifyjs"
+ 
+ if shutil.which(uglifyjs) is None:
+     print("Cannot find executable: {0}".format(uglifyjs))
+     sys.exit(1)
+ 
  input_dir = os.path.abspath("./Resources/Tracker/scripts")
  output_dir = os.path.abspath("./Resources/Tracker/scripts.min")
  
  for file in glob.glob(input_dir + "/*.js"):
      name = os.path.basename(file)
      print("Minifying {0}...".format(name))
      os.system("{0} {1} -o {2}/{3}".format(uglifyjs, file, output_dir, name))
  
  print("Done!")
  
Fix app minification script on non-Windows systems
## Code Before:

import glob
import os

uglifyjs = os.path.abspath("../lib/uglifyjs")
input_dir = os.path.abspath("./Resources/Tracker/scripts")
output_dir = os.path.abspath("./Resources/Tracker/scripts.min")

for file in glob.glob(input_dir + "/*.js"):
    name = os.path.basename(file)
    print("Minifying {0}...".format(name))
    os.system("{0} {1} -o {2}/{3}".format(uglifyjs, file, output_dir, name))

print("Done!")

## Instruction:
Fix app minification script on non-Windows systems
## Code After:

import glob
import os
import shutil
import sys

if os.name == "nt":
    uglifyjs = os.path.abspath("../lib/uglifyjs.cmd")
else:
    uglifyjs = "uglifyjs"

if shutil.which(uglifyjs) is None:
    print("Cannot find executable: {0}".format(uglifyjs))
    sys.exit(1)

input_dir = os.path.abspath("./Resources/Tracker/scripts")
output_dir = os.path.abspath("./Resources/Tracker/scripts.min")

for file in glob.glob(input_dir + "/*.js"):
    name = os.path.basename(file)
    print("Minifying {0}...".format(name))
    os.system("{0} {1} -o {2}/{3}".format(uglifyjs, file, output_dir, name))

print("Done!")
