// Spell checking dictionary for Mozilla Thunderbird
// Script written by rockstiff. Dictionary from ivrix.org.il

const APP_DISPLAY_NAME		= "%DISPLAY_NAME%";
const APP_NAME			= "%APP_NAME%";
const APP_PACKAGE		= "dictionaries.mozdev.org/%APP_NAME%";
const APP_VERSION		= "%VERSION%";

var err = initInstall(APP_NAME, APP_PACKAGE, APP_VERSION);
if (err==SUCCESS) {

  // Copy files to Components/myspell
  var myspell_folder = getFolder("Components", "myspell");
  addFile(APP_NAME, "he.dic", myspell_folder, "");
  addFile(APP_NAME, "he.aff", myspell_folder, "");
  addFile(APP_NAME, "README-he.txt", myspell_folder, "");

  err = getLastError();
  if (err == SUCCESS || err == REBOOT_NEEDED) {

  err = performInstall();
  if(err == SUCCESS || err == 999) {
    alert(APP_DISPLAY_NAME+" (v "+APP_VERSION+") has been succesfully installed.\n");
  }
  else {
    alert("Installation failed. Error:" + err);
    cancelInstall(err);
  }

  } else {
    alert("Installation failed. Error:" + err + "\ncannot addFile. Did you remember to install this file as a privileged user?");
    cancelInstall(err);
  }
}
else {
  cancelInstall(err);
}

