Exemplo n.º 1
0
string getFrameworkInfoPath(
    const string& rootDir,
    const SlaveID& slaveId,
    const FrameworkID& frameworkId)
{
  return path::join(
      getFrameworkPath(rootDir, slaveId, frameworkId), FRAMEWORK_INFO_FILE);
}
Exemplo n.º 2
0
Try<list<string>> getExecutorPaths(
    const string& rootDir,
    const SlaveID& slaveId,
    const FrameworkID& frameworkId)
{
  return fs::list(path::join(
      getFrameworkPath(rootDir, slaveId, frameworkId),
      EXECUTORS_DIR,
      "*"));
}
Exemplo n.º 3
0
Try<list<string>> getExecutorPaths(
    const string& rootDir,
    const SlaveID& slaveId,
    const FrameworkID& frameworkId)
{
  return os::glob(path::join(
      getFrameworkPath(rootDir, slaveId, frameworkId),
      "executors",
      "*"));
}
Exemplo n.º 4
0
string getExecutorPath(
    const string& rootDir,
    const SlaveID& slaveId,
    const FrameworkID& frameworkId,
    const ExecutorID& executorId)
{
  return path::join(
        getFrameworkPath(rootDir, slaveId, frameworkId),
        EXECUTORS_DIR,
        stringify(executorId));
}
Exemplo n.º 5
0
int main(int argc, char **argv)
{
  nsresult rv;
  char *lastSlash;

  char iniPath[MAXPATHLEN];
  char greDir[MAXPATHLEN];
  bool greFound = false;

  CFBundleRef appBundle = CFBundleGetMainBundle();
  if (!appBundle)
    return 1;

  CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(appBundle);
  if (!resourcesURL)
    return 1;

  CFURLRef absResourcesURL = CFURLCopyAbsoluteURL(resourcesURL);
  CFRelease(resourcesURL);
  if (!absResourcesURL)
    return 1;

  CFURLRef iniFileURL =
    CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault,
                                          absResourcesURL,
                                          CFSTR("application.ini"),
                                          false);
  CFRelease(absResourcesURL);
  if (!iniFileURL)
    return 1;

  CFStringRef iniPathStr =
    CFURLCopyFileSystemPath(iniFileURL, kCFURLPOSIXPathStyle);
  CFRelease(iniFileURL);
  if (!iniPathStr)
    return 1;

  CFStringGetCString(iniPathStr, iniPath, sizeof(iniPath),
                     kCFStringEncodingUTF8);
  CFRelease(iniPathStr);

  printf("iniPath = %s\n", iniPath);

  ////////////////////////////////////////

  if (!getExePath(greDir)) {
    return 1;
  }

  /*if (!getFrameworkPath(greDir)) {
    return 1;
    }*/
  /*if (realpath(tmpPath, greDir)) {
    greFound = true;
    }*/

  printf("greDir = %s\n", greDir);
  if (access(greDir, R_OK | X_OK) == 0)
    greFound = true;

  if (!greFound) {
    printf("Could not find the Mozilla runtime.\n");
    return 1;
  }

  rv = XPCOMGlueStartup(greDir);

  if (NS_FAILED(rv)) {
    printf("Couldn't load XPCOM.\n");
    return 1;
  }

  printf("Glue startup OK.\n");

  /////////////////////////////////////////////////////

  static const nsDynamicFunctionLoad kXULFuncs[] = {
    { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
    { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
    { "XRE_main", (NSFuncPtr*) &XRE_main },
    { nullptr, nullptr }
  };

  rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
  if (NS_FAILED(rv)) {
    printf("Couldn't load XRE functions.\n");
    return 1;
  }

  NS_LogInit();

  int retval;

  nsXREAppData *pAppData = NULL;
  {
    nsCOMPtr<nsIFile> iniFile;
    // nsIFile *pIniFile;
    rv = NS_NewNativeLocalFile(nsDependentCString(iniPath), PR_FALSE,
			       getter_AddRefs(iniFile));
                               //&pIniFile);
    //NS_ADDREF(pIniFile);
    if (NS_FAILED(rv)) {
      printf("Couldn't find application.ini file.\n");
      return 1;
    }

    rv = XRE_CreateAppData(iniFile, &pAppData);
    //rv = XRE_CreateAppData(pIniFile, &pAppData);
    if (NS_FAILED(rv)) {
      printf("Error: couldn't parse application.ini.\n");
      return 1;
    }
  }

  NS_ASSERTION(pAppData->directory, "Failed to get app directory.");
  {
    nsAutoString path;
    pAppData->directory->GetPath(path);

    nsAutoCString nsstr;
    ::CopyUTF16toUTF8(path, nsstr);

    printf("appData.directory=%s\n", nsstr.get());
  }

  if (!pAppData->xreDirectory) {
    char xreDir[MAXPATHLEN];
    if (!getFrameworkPath(xreDir))
      return 1;

    rv = NS_NewNativeLocalFile(nsDependentCString(xreDir), PR_FALSE,
			       &pAppData->xreDirectory);
  }
  
  printf("### ENTERING XRE_MAIN ###\n");

  retval = XRE_main(argc, argv, pAppData, 0);

  printf("### LEAVING XRE_MAIN ###\n");

  NS_LogTerm();

  return retval;
}