8 FILE *OpeFileName(
const char *fileNamePrototype)
11 return fopen( (
const char*)GetNewFileName(fileNamePrototype),
"w");
14 TString GetNewFileName(
const char *fileNamePrototype)
17 TString fileName = fileNamePrototype;
18 gSystem->ExpandPathName(fileName);
20 Ssiz_t fileExtension = fileName.Last(
'.');
21 TString fileNameHold = fileName;
22 if ((fileExtension==0) || (fileExtension == -1)) {
23 fileExtension = fileName.Length();
26 while (gSystem->AccessPathName(fileName.Data())==0) {
27 fileName = fileNameHold;
28 fileName.Insert(fileExtension,Form(
".%d",counter++));
34 Int_t SetRootResource(FILE *file,
const char *plugin,
36 const char *full=0,Bool_t append=kFALSE)
38 fprintf(stderr,
" Testing the plugin <%s> from the lib = <%s>\n", plugin, lib);
44 fullName = Form(
"lib%s",lib);
45 fullValue = Form(full,lib);
49 fprintf(stderr,
" ------- \n");
52 if ( !full || gSystem->DynamicPathName(fullName.Data(),kTRUE) ) {
55 TString currentPlugin = gEnv->GetValue(plugin,
"none");
56 TPRegexp exp(Form(
"\\b%s\\b",lib));
57 if ( !currentPlugin.Contains(exp) )
65 gEnv->SetValue(plugin,fullValue);
67 fputs(Form(
"%s %s\n",plugin,fullValue.Data()), file);
81 const char *plugins[] = {
84 ,
" qt TGQt %s \"TGQt(const char*,const char*)\""
86 ,
"Gui.Backend",
"qt", 0
88 ,
"Plugin.TGuiFactory"
90 ,
" qtgui TQtGUIFactory %s \"TQtGUIFactory()\""
92 ,
"Gui.Factory",
"qtgui", 0
94 ,
"Gui.Factory",
"qt" , 0
96 ,
"Plugin.TVirtualPadEditor"
98 ,
" Ged TQtGedEditor %s \"TQtGedEditor(TCanvas*)\""
100 ,
"Plugin.TVirtualViewer3D"
102 ,
" ogl TQtRootViewer3D %s \"TQtRootViewer3D(TVirtualPad*)\""
104 ,
"Plugin.TVirtualViewer3D"
106 ,
" oiv TQtRootCoinViewer3D %s \"TQtRootCoinViewer3D(TVirtualPad*)\""
111 TString fileName = GetNewFileName(
"rootrc");
112 FILE *f = fopen((
const char *)fileName,
"w");
114 if (c+=SetRootResource(f,plugins[iPlugin++],plugins[iPlugin++],plugins[iPlugin++])) {
115 c+=SetRootResource(f,plugins[iPlugin++],plugins[iPlugin++],plugins[iPlugin++]);
117 if (c+=SetRootResource(f,plugins[iPlugin++],plugins[iPlugin++],plugins[iPlugin++])) {
118 if (c+=SetRootResource(f,plugins[iPlugin++],plugins[iPlugin++],plugins[iPlugin++])) {
121 iPlugin++;iPlugin++;iPlugin++;
124 c+=SetRootResource(f,plugins[iPlugin++],plugins[iPlugin++],plugins[iPlugin++]);
128 c+=SetRootResource(f,plugins[iPlugin++],plugins[iPlugin++],plugins[iPlugin++]);
131 if (c+=SetRootResource(f,plugins[iPlugin++],plugins[iPlugin++],plugins[iPlugin++])) {
133 if (gSystem->DynamicPathName(
"libCoin",kTRUE)) {
134 c+=SetRootResource(f,plugins[iPlugin++],plugins[iPlugin++],plugins[iPlugin++],kTRUE);
136 fprintf( stderr,
"\"Coin3d\" shared libraies has not beed detected\n");
137 fprintf( stderr,
"Please, run \"source $STAR/QtRoot/qtgl/qtcoin/setup.csh\" script to set the Coin3D env.\n");
142 fprintf(stderr,
" No shared library to activate the Qt-layer has been detected.\n Please talk to your SysAdmin\n");
143 gSystem->Unlink(fileName.Data());
145 Long_t id; Long_t size; Long_t flags; Long_t modtime;
146 gSystem->GetPathInfo(fileName.Data(), &id, &size, &flags, &modtime);
148 fprintf(stderr,
" ----------------------------------------------------------\n");
149 fprintf(stderr,
" The correct Qt/Root env has been detected.\n");
150 fprintf(stderr,
" ----------------------------------------------------------\n");
151 gSystem->Unlink(fileName.Data());
153 fprintf(stderr,
" ----------------------------------------------------------\n");
154 fprintf(stderr,
" The new version of ROOT resource file has been created: <%s>.\n",fileName.Data());
155 if (gSystem->AccessPathName(
".rootrc")) {
156 fprintf(stderr,
" To active the Qt-layer - create a symlink \"ln -s %s .rootrc \" \n", fileName.Data());
158 fprintf(stderr,
" To active the Qt-layer - merge the existen \".rootrc\" file with \"%s\" \n", fileName.Data());
160 fprintf(stderr,
" and re-start your application\n");
161 fprintf(stderr,
" ----------------------------------------------------------\n");