Changeset 2105 in Sophya


Ignore:
Timestamp:
Jul 17, 2002, 7:29:53 PM (23 years ago)
Author:
ansari
Message:

Creation Tmpdir pour piapp par mktemp - Reza 17/7/2002

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/ProgPI/piapp.cc

    r2093 r2105  
    4343  \verbatim
    4444  csh> spiapp -h
    45   SOPHYA Version  1.1 Revision 0 (V_Fev2001) -- Mar  9 2001 15:45:31 cxx
    46 
    47   piapp: Interactive data analysis and visualisation program
    48   Usage: piapp [-nored] [-nosig] [-nosigfpe] [-nosigsegv]
    49                [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]]
     45  SOPHYA Version  1.3 Revision 70 (V_Jun2002) -- Jul 16 2002 15:45:53 cxx
     46
     47   piapp: Interactive data analysis and visualisation program
     48   Usage: piapp [-nored] [-nosig] [-nosigfpe] [-nosigsegv] [-hidezswin]
     49                [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]]
    5050    -nored : NoRedirect StdOut/StdErr
    5151    -nosig : Don't catch SigFPE, SigSEGV
    5252    -nosigfpe -nosigsegv: Don t catch SigFPE / SigSEGV
     53    -hidezswin : Hide Zoom/Stat/ColMap window
    5354    -tmpdir TmpDirectory: defines TMDIR for temporary files
    5455    -help2tex: Create a LaTeX help file (piahelp.tex)
     
    133134              (double)PI_VERSIONNUMBER, (double)skyinit.Version());
    134135
    135 char *vcmds=NULL;
     136char* vcmds=NULL;
     137string vcmd;
    136138if (fgtmp) {
    137139  if (tmpdir[tmpdir.length()-1] != '/') tmpdir += '/';  // Necessaire pour SetSwapPath
    138   string vcmd = "TMPDIR=" + tmpdir;
     140  vcmd = "TMPDIR=" + tmpdir;
    139141  vcmds = new char[vcmd.length()+1];
    140142  strcpy(vcmds, vcmd.c_str());
     
    142144}
    143145
     146char* tmpde = getenv("TMPDIR");
     147char  tmpdname[32];
     148if (tmpde == NULL) tmpde = "./";
     149if (tmpde[strlen(tmpde)-1] != '/')
     150  strcpy(tmpdname, "/PIATmp_XXXXXX");
     151else
     152  strcpy(tmpdname, "PIATmp_XXXXXX");
     153mktemp(tmpdname);
     154tmpdir = tmpde;
     155tmpdir += tmpdname;
     156tmpdir += '/';
     157vcmd = "mkdir ";
     158vcmd += tmpde;
     159vcmd += tmpdname;
     160cout << " --piapp: Creating Tmp Directory: " << tmpdir << endl;
     161int rcc = system(vcmd.c_str());
     162if (rcc != 0) {
     163  cout << " --piapp: Error creating TmpDir " << vcmd << " ---> exit !" << endl;
     164  return(9);
     165}
     166
     167// On cree un repertoire temporaire
    144168// cout << " DBG-TMPDIR= " << getenv("TMPDIR") << endl;
    145169
    146170PIStdImgApp * app = new PIStdImgApp(narg, arg);
    147171// cout << " DBG-2 " <<  app->ObjMgr()->GetTmpDir() << endl;
    148 if (fgtmp) {  // Changement de tmpdir
    149   cout << "  NamedObjMgr::SetTmpDir()+XNTuple::SetSwapPath() " << tmpdir << endl;
    150   app->ObjMgr()->SetTmpDir(tmpdir);
    151   XNTuple::SetSwapPath(const_cast<char *>(tmpdir.c_str()));
    152 }
     172cout << "  NamedObjMgr::SetTmpDir()+XNTuple::SetSwapPath() " << tmpdir << endl;
     173app->ObjMgr()->SetTmpDir(tmpdir);
     174XNTuple::SetSwapPath(const_cast<char *>(tmpdir.c_str()));
     175
    153176
    154177
     
    239262  }
    240263}
     264cout << "\n ------------------------------------------------ \n"
     265     << " piapp: Cleaning up ... " << endl;
    241266
    242267app->RedirectStdOutErr(false); 
     
    249274if (fgtmp) delete[] vcmds;
    250275
    251 cout << "\n------------------------------------------------ \n"
     276vcmd = "rm -rf ";
     277vcmd += tmpdir;
     278cout << " --piapp: Removing Tmp Directory: " << tmpdir << endl;
     279rcc = system(vcmd.c_str());
     280if (rcc != 0) {
     281  cout << " --piapp: Error deleting TmpDir " << vcmd << endl;
     282  return(9);
     283}
     284
     285cout << "------------------------------------------------ \n"
    252286     << "-------- piapp : Exiting .... Rc= " << rc << " -----------\n"
    253287     << "------------------------------------------------ " << endl;
Note: See TracChangeset for help on using the changeset viewer.