Changeset 19594


Ignore:
Timestamp:
2009-05-26T11:55:45+12:00 (15 years ago)
Author:
oranfry
Message:

cdrom wrapper needs to use temp dir, so basing it off web wrapper after all

Location:
release-kits/shared
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • release-kits/shared/linux/wrapper.cpp

    r19510 r19594  
    22#include <fstream>
    33#include <iomanip>
     4#include <cstring>
    45#include <cstdlib>
    5 
    66using namespace std;
    77
     8#ifdef WEB
    89#include "wrapper.h"
    910#include "libsearch4j.h"
    10 
    1111bool extract_bundled_file( const char[], int, char*, bool );
     12#endif
    1213
    1314int main(int argc, char** argv) {
     
    1516    char owd[1024];
    1617    getcwd(owd, sizeof(owd));
    17 
    1818    string scratch = (getenv("TMPDIR") == NULL) ? "/tmp" : getenv("TMPDIR");
    19     string tempdir = scratch + "/@[email protected]"; //temporary directory where we will store extracted files
    20     string jarfile = tempdir + "/@[email protected]"; //where we will store the jar file
    21     string javafile = tempdir + "/@java.installer@"; //where we will store the java tar file
     19    string tempdir = scratch + "/greenstone-installer.tmp"; //temporary directory where we will store extracted files
    2220    bool succeeded = false;
    2321    bool textMode = false;
     
    4442        return 1;
    4543    }
     44   
     45    #ifdef WEB
     46
     47    string jarfile = tempdir + "/@[email protected]"; //where we will store the jar file
     48    string javafile = tempdir + "/@java.installer@"; //where we will store the java tar file
     49
    4650
    4751    //extract files
     
    6266    }
    6367
     68    #endif
     69
    6470    //change to the temp directory
    6571    chdir( tempdir.c_str() );
    6672
     73
     74    #ifdef WEB
    6775    #ifdef java_is_bundled
    6876    succeeded = (system( "/bin/sh -c ./@java.installer@ > /dev/null" ) == 0);
     
    118126
    119127    }
     128    #endif
     129
     130    #ifdef CDROM
     131        string cmd = "";
     132        cmd.append( owd );
     133        cmd.append( "/Java/Linux/jre/bin/java -Dorig.dir=\"" );
     134        cmd.append( owd );
     135        cmd.append( "\" -jar " );
     136        cmd.append( owd );
     137        cmd.append( "/Java/Jars/linux.jar" );
     138        system( cmd.c_str() );
     139    #endif
    120140
    121141    //change to the scratch dir for the following operation
     
    129149
    130150}
    131 
     151#ifdef WEB
    132152bool extract_bundled_file( const char data[], int size, char* filename, bool make_executable) {
    133153
     
    166186
    167187}
     188#endif
  • release-kits/shared/windows/wrapper/wrapper.cpp

    r19587 r19594  
    88#include <shellapi.h>
    99#include <direct.h>
     10
     11using namespace std;
     12
     13#ifdef WEB
    1014#include "libsearch4j.h"
    11 
    12 using namespace std;
     15#endif
    1316
    1417//globals
     
    310313    delete tmp; //  deallocate memory
    311314   
     315    #ifdef WEB
    312316    //rip out java archive if it is bundled
    313317    set_splash_step( "XJAVA" );
     
    380384        }
    381385    }
     386
     387    #endif
     388
     389    #ifdef CDROM
     390
     391    //ask if they want to install, then do it if so
     392    int choice = MessageBox(NULL, "Install Greenstone?", "Greenstone", MB_OKCANCEL | MB_ICONQUESTION );
     393    if ( choice == IDOK ) {
     394
     395        //launch the jar
     396        set_splash_step( "LAUNCHING" );
     397        spoof_progress( SPOOF_TIME );
     398        string cmd = "\"";
     399        cmd.append( owd );
     400        cmd.append( "\\Java\\Windows\\jre\\bin\\java.exe\" \"-Dorig.dir=" );
     401        cmd.append( owd );
     402        cmd.append( "\" -jar greenstone.jar" );
     403
     404        //hide splash screen
     405        ShowWindow(splashWnd, SW_HIDE);
     406       
     407        //run the jar
     408        int launch_exit_code = process( cmd, false );
     409    }
     410
     411    #endif
    382412   
    383413    //clean up the temp directory
Note: See TracChangeset for help on using the changeset viewer.