Advertisement
KosIvantsov

run_statistics.groovy

Nov 27th, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 1.06 KB | None | 0 0
  1. //define full path to OTStats if it's not in the $PATH
  2. otstats = 'OTStats'
  3.  
  4. import static javax.swing.JOptionPane.*
  5. import static org.omegat.util.Platform.*
  6.  
  7. sys = System.getProperty("os.name")
  8. if (sys != 'Linux'){
  9.     final def title = 'Run OTStats'
  10.     final def msg   = 'This script is intended for GNU/Linux only.'
  11.     console.print "\n*****\n$msg"
  12.     showMessageDialog null, msg, title, INFORMATION_MESSAGE
  13. return
  14. }
  15.  
  16. prop = project.getProjectProperties()
  17. if (!prop) {
  18.     final def title = 'Run OTStats'
  19.     final def msg   = 'Please try again after you open a project.'
  20.     console.println "\n*****\n$msg"
  21.     showMessageDialog null, msg, title, INFORMATION_MESSAGE
  22.     return
  23.     }
  24.  
  25. folder = System.getProperty('user.home')+'/.OTStats/'
  26. writefile = new File(folder+'root.ini')
  27. if (! (new File(folder)).exists()) {
  28.     (new File(folder)).mkdir()
  29.     }
  30. projroot = prop.getProjectRoot()
  31. folders = projroot.tokenize('/')
  32. current_folder = folders[folders.size()-1].toString()
  33. writefile.write("${projroot - current_folder - '//'}", 'UTF8')
  34.  
  35. [otstats, current_folder].execute()
  36.  
  37. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement