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.
14  *
15  */
16 #if !defined(USE_HILDON) && !defined(WIN32)
17 
18 #include "Os.h"
19 #include <stdlib.h>
20 #include <string.h>
21 #include <stdio.h>
22 
23 class OsFreeDesktop : public Os
24 {
25  public:
26 
openBrowser(const char * url)27   virtual bool openBrowser( const char* url )
28   {
29     if ( url && strlen(url) < 200 ) {
30       char buf[256];
31       snprintf(buf,256,"xdg-open %s",url);
32       if ( system( buf ) == 0 ) {
33 	return true;
34       }
35     }
36     return false;
37   }
38 
saveDialog(const char * path)39   virtual char* saveDialog( const char* path )
40   {
41     //TODO - gtk?
42     return NULL;
43   }
44 };
45 
46 
get()47 Os* Os::get()
48 {
49   static OsFreeDesktop os;
50   return &os;
51 }
52 
53 const char Os::pathSep = '/';
54 
main(int argc,char ** argv)55 int main(int argc, char** argv)
56 {
57   npmain(argc,argv);
58 }
59 
60 #endif
61