SCIHOME.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SCIHOME.h"
#include "MALLOC.h"
#include "version.h"
#include "machine.h"
#include "../../../io/includes/createdir.h"
#include "../../../io/includes/getenvc.h"

Include dependency graph for SCIHOME.c:

Go to the source code of this file.

Defines

#define MAX_PATH   260
#define DIRSEPARATOR   "/"
#define BASEDIR   ".Scilab"

Functions

BOOL setSCIHOME (void)
char * getSCIHOME (void)

Variables

static char SCIHOMEPATH [MAX_PATH *2] = "empty_SCIHOME"


Define Documentation

#define BASEDIR   ".Scilab"

Referenced by setSCIHOME().

#define DIRSEPARATOR   "/"

Referenced by setSCIHOME().

#define MAX_PATH   260

Definition at line 17 of file SCIHOME.c.

Referenced by AppendMessageToLog(), C2F(), Callback_CHDIR(), Callback_EMAIL(), Callback_EXEC(), Callback_GETF(), Callback_LOAD(), Callback_NEWSCILAB(), Callback_OPEN(), Callback_SAVE(), CommandByFileExtension(), ConfigureScilabStar(), CreateButton(), CutLineForDisplay(), DragFunc(), FindFileAssociation(), FindFreeScilexNumber(), GetFileExtension(), GetLanguageCodeInScilabDotStar(), GetWhereIsThisExe(), HelpOn(), Initialize(), MessageBoxNewGraphicMode(), ModifyFile(), NewFigure(), ON_ABOUT_WM_COMMAND(), ON_ABOUT_WM_INITDIALOG(), ON_MESSAGEBOXNEWGRAPHICMODE_WM_COMMAND(), ON_MESSAGEBOXNEWGRAPHICMODE_WM_INITDIALOG(), ON_WND_CONSOLE_WM_COPYDATA(), ON_WND_CONSOLE_WM_CREATE(), OpenSaveSCIFile(), OpenSelection(), ReadRegistryGraph(), ReadRegistryTxt(), ReceiveFromAnotherScilab(), RenameConsole(), SciEnv(), SendCTRLandAKey(), Set_HOME_PATH(), Set_SCI_PATH(), Set_TCL_LIBRARY_PATH(), Set_TK_LIBRARY_PATH(), setSCIHOME(), TestRegistryKey(), UpdateFileGraphNameMenu(), Windows_Main(), WindowsQueryRegistry(), WindowsQueryRegistryNumberOfElementsInList(), WriteRegistryGraph(), and WriteRegistryTxt().


Function Documentation

char* getSCIHOME ( void   ) 

Definition at line 87 of file SCIHOME.c.

References MALLOC, NULL, and SCIHOMEPATH.

Referenced by getfilenamelanguagepref(), and getscihome().

00088 {
00089         char *retSCIHOME=NULL;
00090         retSCIHOME=(char*)MALLOC(sizeof(char)*(strlen(SCIHOMEPATH)+1));
00091         strcpy(retSCIHOME,SCIHOMEPATH);
00092         return retSCIHOME;
00093 }

Here is the caller graph for this function:

BOOL setSCIHOME ( void   ) 

Definition at line 26 of file SCIHOME.c.

References BASEDIR, buflen, C2F, CreateDir(), DIRSEPARATOR, env, ExistDir(), FALSE, getenvc(), ierr, iflag, MAX_PATH, putenv, SCI_VERSION_STRING, SCIHOMEPATH, and TRUE.

Referenced by getscihome(), and SciEnv().

00027 {
00028         BOOL bOK=FALSE;
00029         int ierr=0;
00030         int buflen=MAX_PATH;
00031         int iflag=0;
00032         
00033         char SCIHOME[MAX_PATH];
00034         char USERPATHSCILAB[MAX_PATH];
00035         
00036         C2F(getenvc)(&ierr,"SCIHOME",SCIHOME,&buflen,&iflag);
00037 
00038         if (ierr) /* SCIHOME not define */
00039         {
00040                 #ifdef _MSC_VER
00041                         #define DIRSEPARATOR "\\"
00042                         #define BASEDIR "Scilab"
00043                 #else
00044                         #define DIRSEPARATOR "/"
00045                         #define BASEDIR ".Scilab"
00046                 #endif
00047 
00048                 char env[MAX_PATH+1+10];
00049                 char USERHOMESYSTEM[MAX_PATH];
00050                 iflag=1;
00051 
00052                 #ifdef _MSC_VER
00053                         C2F(getenvc)(&ierr,"USERPROFILE",USERHOMESYSTEM,&buflen,&iflag);
00054                 #else
00055                         C2F(getenvc)(&ierr,"HOME",USERHOMESYSTEM,&buflen,&iflag);
00056                 #endif
00057 
00058 
00059                 if (ierr) {return bOK; }
00060                 else
00061                 {
00062                         sprintf(USERPATHSCILAB,"%s%s%s",USERHOMESYSTEM,DIRSEPARATOR,BASEDIR);
00063                         sprintf(SCIHOMEPATH,"%s%s%s",USERPATHSCILAB,DIRSEPARATOR,SCI_VERSION_STRING);
00064                 }
00065                 sprintf(env,"SCIHOME=%s",SCIHOMEPATH);
00066                 putenv(env);
00067         }
00068         else
00069         {
00070                 strcpy(SCIHOMEPATH,SCIHOME);
00071         }
00072 
00073         if (!ExistDir(SCIHOMEPATH))
00074         {
00075                 if(!ExistDir(USERPATHSCILAB)) CreateDir(USERPATHSCILAB);
00076                 if (CreateDir(SCIHOMEPATH))
00077                 {
00078                         bOK=TRUE;
00079                         return bOK;
00080                 }
00081         }
00082         else bOK=TRUE;
00083         
00084         return bOK;
00085 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char SCIHOMEPATH[MAX_PATH *2] = "empty_SCIHOME" [static]

Definition at line 24 of file SCIHOME.c.

Referenced by getSCIHOME(), and setSCIHOME().


Generated on Sun Mar 4 15:16:33 2007 for Scilab [trunk] by  doxygen 1.5.1