예제 #1
0
/**
 * Application entry point.
 */
int main ( int argc, char **argv )
{
    for ( int i = 0;i < argc;i++ )
    {
        if ( !strcmp( argv[ i ], "-v" ) || !strcmp( argv[ i ], "--version" ) )
        {
            fxmessage( "\n%s\n", PACKAGE_STRING );
            return 0;
        }

        if ( !strcmp( argv[ i ], "-h" ) || !strcmp( argv[ i ], "--help" ) )
        {
            fxmessage( "\n-h, --help print this help\n" );
            fxmessage( "-v, --version print version\n" );
            return 0;
        }
    }

    string tmpdir = "/tmp/nao";
    if ( !FXFile::exists( tmpdir.c_str() ) )
    {
        FXFile::createDirectory( tmpdir.c_str(), 493 );
    }

    string dir = FXFile::getUserDirectory ( "" ).text ();
    dir = dir + "/.nao";
    string file = dir + "/nao.conf";

    if ( !FXFile::exists( file.c_str() ) )
    {
        FXFile::createDirectory( dir.c_str(), 493 );
        string dir2 = dir + "/icons";
        FXFile::createDirectory( dir2.c_str(), 493 );
        dir += "/plugins";
        FXFile::createDirectory( dir.c_str(), 493 );
        dir2 = dir + "/cmddialog";
        FXFile::createDirectory( dir2.c_str(), 493 );
        dir2 = dir + "/filelist";
        FXFile::createDirectory( dir2.c_str(), 493 );


        string src = PATH_CFG + string( "/nao.conf" );
        FXFile::copy( src.c_str(), file.c_str() );
    }
    fxTraceLevel = 0;
    FXApp *application = new FXApp ( "nao", NULL );
    application->init ( argc, argv );

    new OSMainWindow ( application );
    application->create ();
    return application->run ();
}
예제 #2
0
파일: main.cpp 프로젝트: rbemmanuel/kwama
static OSStatus
EventLoopEventHandler(EventHandlerCallRef callref,
                      EventRef event, void *userdata)
{
  FXApp *app = (FXApp*)userdata;

  if (nil != event) ReleaseEvent(event);

  app->run(); // Start FOX GUI
 
  QuitApplicationEventLoop();

  return noErr;
}