Add pointlog2svg utility for the thesis
[numtypysics.git] / OsFreeDesktop.cpp
blobf774f254210de156fa34026fdb00b45f229055d7
1 /*
2 * This file is part of NumptyPhysics
3 * Copyright (C) 2008 Tim Edmonds
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
16 #if !defined(USE_HILDON) && !defined(WIN32)
18 #include "Os.h"
19 #include <stdlib.h>
20 #include <string.h>
21 #include <stdio.h>
23 /**
24 * Include SDL, so that under Mac OS X it can rename my main()
25 * function to SDL_main (else NP *will* crash on OS X).
27 * http://www.libsdl.org/faq.php?action=listentries&category=7#55
28 **/
29 #include "SDL/SDL.h"
31 class OsFreeDesktop : public Os
33 public:
35 virtual bool openBrowser( const char* url )
37 if ( url && strlen(url) < 200 ) {
38 char buf[256];
39 snprintf(buf,256,"xdg-open %s",url);
40 if ( system( buf ) == 0 ) {
41 return true;
44 return false;
47 virtual char* saveDialog( const char* path )
49 //TODO - gtk?
50 return NULL;
55 Os* Os::get()
57 static OsFreeDesktop os;
58 return &os;
61 const char Os::pathSep = '/';
63 int main(int argc, char** argv)
65 npmain(argc,argv);
68 #endif