Ejemplo n.º 1
0
int boot(int argc, char *args[]) {
    screen.reset(new P47Screen());
    pad.reset(new Pad());
    try {
        pad->openJoystick();
    } catch (const exception& e) {}
    gameManager.reset(new P47GameManager());
    prefManager.reset(new P47PrefManager());
    mainLoop.reset(new MainLoop(screen, pad, gameManager, prefManager));
    try {
        parseArgs(argc, args);
    } catch (const exception& e) {
        return EXIT_FAILURE;
    }
    mainLoop->loop();
    return EXIT_SUCCESS;
}
  sshfs_t filesystem_adaptor::mount_sshfs (const saga::session & s, const saga::url & u )
  {
    saga::url   tgt = u;

    // if url is any:// based, convert to ssh:// as expected by sshfs
    if ( tgt.get_scheme () == "any" )
    {
      tgt.set_scheme ("ssh");
    }

    std::string id  = get_sshfs_id (tgt);

    
    // std::cout << " mounted_        mount  :  " << this             << std::endl;
    // std::cout << " mounted_.size() mount 1:  " << mounted_.size () << std::endl;
    // std::cout << " tested__.size() mount 1:  " << tested__.size () << std::endl;

    // check if we have that mounted already
    if ( mounted_.find (id) != mounted_.end () )
    {
      // make sure the fs is mounted
      mounted_[id]->mount ();

      return mounted_[id];
    }

    // is not mounted, yet - try to mount it, store a new shared pointer, and
    // return it.
    SAGA_LOG_ALWAYS ("to mount new sshfs");
    SAGA_LOG_ALWAYS (id.c_str ());
    SAGA_LOG_ALWAYS (tgt.get_string ().c_str ());

    TR1::shared_ptr <sshfs> ptr;
    try 
    {
      ptr.reset (new sshfs (ini_, s, tgt));
    }
    catch ( const saga::exception & e )
    {
      SAGA_LOG_ERROR (e.what ());
      std::stringstream ss;
      ss << "Could not mount sshfs for " << tgt << " : \n  " << e.what () <<
        std::endl;
      SAGA_ADAPTOR_THROW_NO_CONTEXT (ss.str ().c_str (), saga::BadParameter);
    }

    if ( ! ptr )
    {
      // cannot mount the fs for some reason - throw a BadParameter
      SAGA_ADAPTOR_THROW_NO_CONTEXT ("sshfs mount failed for unknown reason",
                                     saga::NoSuccess);
    }

    // std::cout << " mounted_.size() mount 2:  " << mounted_.size () << std::endl;
    // std::cout << " tested__.size() mount 2:  " << tested__.size () << std::endl;

    // got the fs mounted - register it, and return the ptr
    mounted_[id] = ptr;
    tested__[id] = 1;
    SAGA_LOG_ALWAYS ("register mounted sshfs");
    SAGA_LOG_ALWAYS (id.c_str ());

    // std::cout << " === register mounted sshfs: " << id << std::endl;
    // std::cout << " mounted_.size() mount 3:  " << mounted_.size () << std::endl;
    // std::cout << " tested__.size() mount 3:  " << tested__.size () << std::endl;

    return ptr;
  }