/**
 * \fn call_scriptEngine
 * @param scriptFile
 */
void call_scriptEngine(const char *scriptFile)
{
    std::vector<IScriptEngine*> engines = getScriptEngines();
    
    std::string root,ext;
    ADM_PathSplit(std::string(scriptFile),root,ext);
  
	if (engines.size() == 1)
	{
            A_parseScript(engines[0], scriptFile);
	    A_Rewind();
            UI_setMarkers(video_body->getMarkerAPts(),video_body->getMarkerBPts());
        return;
	}
	
    for (int i = 0; i < engines.size(); i++)
    {
        if (!engines[i]->defaultFileExtension().compare(ext))
        {
            A_parseScript(engines[i], scriptFile);
            A_Rewind();
            UI_setMarkers(video_body->getMarkerAPts(),video_body->getMarkerBPts());
            return;
        }
    }

    ADM_warning("Unable to appropriate script engine for script file\n");	
}
void checkCrashFile(void)
{
  char *baseDir=ADM_getBaseDir();
  const char *name=CRASH_FILE;
  static int crashCount=0;
  char *where=new char[strlen(baseDir)+strlen(name)+2];
  strcpy(where,baseDir);
  strcat(where,name);
  if(ADM_fileExist(where))
  {
	  IScriptEngine *engine = getDefaultScriptEngine();

	  if (engine != NULL)
	  {
    if(GUI_Confirmation_HIG(QT_TR_NOOP("Load it"),QT_TR_NOOP("Crash file"),
       QT_TR_NOOP("I have detected a crash file. \nDo you want to load it  ?\n(It will be deleted in all cases, you should save it if you want to keep it)")))
    {
       A_parseScript(engine,where);
    }
	  }

    unlink(where);
  }else
  {
    printf("No crash file (%s)\n",where);
  }
  delete [] where;
}
Exemple #3
0
/**
 * \fn call_scriptEngine
 * @param scriptFile
 */
void call_scriptEngine(const char *scriptFile)
{
    char *fullpath=ADM_PathCanonize(scriptFile);
    FILE *fd=ADM_fopen(fullpath,"r");
    if(!fd)
    {
        if(errno == EACCES)
        {
            GUI_Error_HIG(QT_TRANSLATE_NOOP("adm", "Permission Error"), QT_TRANSLATE_NOOP("adm", "Cannot open script \"%s\"."), fullpath);
        }
        if(errno == ENOENT)
        {
            GUI_Error_HIG(QT_TRANSLATE_NOOP("adm", "File Error"), QT_TRANSLATE_NOOP("adm", "Script \"%s\" does not exist."), fullpath);
        }
        return;
    }

    std::vector<IScriptEngine*> engines = getScriptEngines();
    std::string root,ext;
    ADM_PathSplit(std::string(fullpath),root,ext);
  
    if(engines.size() == 1)
    {
        A_parseScript(engines[0],fullpath);
        if(avifileinfo)
        {
            A_Rewind();
            UI_setMarkers(video_body->getMarkerAPts(),video_body->getMarkerBPts());
        }
        return;
    }

    for (int i = 0; i < engines.size(); i++)
    {
        if (!engines[i]->defaultFileExtension().compare(ext))
        {
            A_parseScript(engines[i],fullpath);
            A_Rewind();
            UI_setMarkers(video_body->getMarkerAPts(),video_body->getMarkerBPts());
            return;
        }
    }

    ADM_warning("Unable to appropriate script engine for script file\n");    
}