forked from dhamilton-glasgow/g4sbs
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrootlogon_install.C
55 lines (40 loc) · 1.54 KB
/
rootlogon_install.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
void rootlogon(){
//Check for a pre-existing rootlogon.C file in the current working directory and/or
//the current user's home directory:
TString cwd = gSystem->GetWorkingDirectory();
TString username = gSystem->Getenv("USER");
TString homedir = gSystem->GetHomeDirectory(username.Data());
//check current working directory first:
TString fnametemp = cwd + "/rootlogon.C";
FILE *ftest = fopen( fnametemp.Data(),"r");
if( ftest != NULL ){
cout << "found rootlogon.C in current working directory, executing..." << endl;
TString cmd = ".x " + fnametemp;
gROOT->ProcessLine(cmd.Data());
fclose( ftest );
}
if( homedir != cwd ){ //also check in user's home directory:
fnametemp = homedir + "/rootlogon.C";
ftest = fopen(fnametemp.Data(),"r");
if( ftest != NULL ){
cout << "found rootlogon.C in current user's home directory, executing..." << endl;
TString cmd = ".x " + fnametemp;
gROOT->ProcessLine(cmd.Data());
fclose( ftest );
}
}
//gSystem->AddIncludePath(" -I${PROJECT_SOURCE_DIR}/include");
//gSystem->AddIncludePath(" -I${CMAKE_INSTALL_PREFIX}/include");
gSystem->AddIncludePath(" -I${CMAKE_INSTALL_FULL_INCLUDEDIR}");
TString libname = "${CMAKE_INSTALL_FULL_LIBDIR}/libg4sbsroot.so";
SysInfo_t sysinfo;
gSystem->GetSysInfo( &sysinfo );
TString OSname = sysinfo.fOS;
if( OSname == "Darwin" ){
libname.ReplaceAll(".so",".dylib");
}
FileStat_t buf;
if( !gSystem->GetPathInfo(libname.Data(), buf) ){
gSystem->Load( libname.Data() ) ;
}
}