instead of copying musrfit_startup.xml to the appropriate directory, create it at run-time if needed. This has the advantage that each user will automatically create its own file.
This commit is contained in:
@ -60,9 +60,6 @@ write_musrRoot_runHeader_SOURCES = write_musrRoot_runHeader.cpp
|
|||||||
musrRootValidation_SOURCES = musrRootValidation.cpp
|
musrRootValidation_SOURCES = musrRootValidation.cpp
|
||||||
dump_header_SOURCES = dump_header.cpp
|
dump_header_SOURCES = dump_header.cpp
|
||||||
|
|
||||||
xmldir = $(HOME)/.musrfit
|
|
||||||
xml_DATA = musrfit_startup.xml
|
|
||||||
|
|
||||||
LIBADD = $(PMUSR_LIBS) $(MUSR_ROOT_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS)
|
LIBADD = $(PMUSR_LIBS) $(MUSR_ROOT_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS)
|
||||||
|
|
||||||
AM_CXXFLAGS = $(LOCAL_BIN_CXXFLAGS)
|
AM_CXXFLAGS = $(LOCAL_BIN_CXXFLAGS)
|
||||||
@ -75,42 +72,3 @@ endif
|
|||||||
|
|
||||||
LIBS = $(PMUSR_LIBS) $(USERFCN_LIBS) $(MUSR_ROOT_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS) \
|
LIBS = $(PMUSR_LIBS) $(USERFCN_LIBS) $(MUSR_ROOT_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS) \
|
||||||
$(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS) $(LIBXML2_LIBS)
|
$(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS) $(LIBXML2_LIBS)
|
||||||
|
|
||||||
install-xmlDATA: $(xml_DATA)
|
|
||||||
test -z "$(xmldir)" || $(mkdir_p) "$(DESTDIR)$(xmldir)"
|
|
||||||
@if test -e "$(DESTDIR)$(xmldir)/$(xml_DATA)"; then \
|
|
||||||
DIFF="$$(diff "$(DESTDIR)$(xmldir)/$(xml_DATA)" "$(xml_DATA)" 2>&1)"; \
|
|
||||||
if test "x$$DIFF" != "x"; then \
|
|
||||||
echo " " && \
|
|
||||||
echo " musrfit_startup.xml in $(xmldir)" && \
|
|
||||||
echo " is different from the distribution's version." && \
|
|
||||||
echo " Do you want to overwrite it? [y/N]" && \
|
|
||||||
read OVERWRITE && \
|
|
||||||
if test "$$OVERWRITE" = "y" || test "$$OVERWRITE" = "Y"; then \
|
|
||||||
echo "$(INSTALL_DATA) '$(xml_DATA)' '$(DESTDIR)$(xmldir)'" && \
|
|
||||||
$(INSTALL_DATA) '$(xml_DATA)' '$(DESTDIR)$(xmldir)'; \
|
|
||||||
fi; \
|
|
||||||
fi; \
|
|
||||||
else \
|
|
||||||
echo "$(INSTALL_DATA) '$(xml_DATA)' '$(DESTDIR)$(xmldir)'" && \
|
|
||||||
$(INSTALL_DATA) '$(xml_DATA)' '$(DESTDIR)$(xmldir)'; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
uninstall-xmlDATA:
|
|
||||||
@if test -e "$(DESTDIR)$(xmldir)/$(xml_DATA)"; then \
|
|
||||||
DIFF="$$(diff "$(DESTDIR)$(xmldir)/$(xml_DATA)" "$(xml_DATA)" 2>&1)"; \
|
|
||||||
if test "x$$DIFF" != "x"; then \
|
|
||||||
echo " " && \
|
|
||||||
echo " musrfit_startup.xml in $(xmldir)" && \
|
|
||||||
echo " is different from the distribution's version." && \
|
|
||||||
echo " Do you want to remove it? [y/N]" && \
|
|
||||||
read REMOVE && \
|
|
||||||
if test "$$REMOVE" = "y" || test "$$REMOVE" = "Y"; then \
|
|
||||||
echo "$(RM) '$(DESTDIR)$(xmldir)/$(xml_DATA)'" && \
|
|
||||||
$(RM) "$(DESTDIR)$(xmldir)/$(xml_DATA)"; \
|
|
||||||
fi; \
|
|
||||||
else \
|
|
||||||
echo "$(RM) '$(DESTDIR)$(xmldir)/$(xml_DATA)'" && \
|
|
||||||
$(RM) "$(DESTDIR)$(xmldir)/$(xml_DATA)"; \
|
|
||||||
fi; \
|
|
||||||
fi
|
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -140,6 +143,23 @@ PStartupHandler::PStartupHandler()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if musrfit_startup.xml is still not found, will create a default one
|
||||||
|
if (!fStartupFileFound) {
|
||||||
|
cout << endl << "**INFO** no musrfit_startup.xml file found, will write a default one." << endl;
|
||||||
|
if (!WriteDefaulStartupFile()) {
|
||||||
|
cerr << endl << "**ERROR** couldn't write default musrfit_startup.xml." << endl;
|
||||||
|
} else {
|
||||||
|
home = getenv("HOME");
|
||||||
|
if (home != 0) {
|
||||||
|
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
|
||||||
|
if (StartupFileExists(startup_path_name)) {
|
||||||
|
fStartupFilePath = TString(startup_path_name);
|
||||||
|
fStartupFileFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -566,6 +586,107 @@ Bool_t PStartupHandler::StartupFileExists(Char_t *fln)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// WriteDefaulStartupFile
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
Bool_t PStartupHandler::WriteDefaulStartupFile()
|
||||||
|
{
|
||||||
|
// get home
|
||||||
|
Char_t startup_path_name[256];
|
||||||
|
Char_t *home=0;
|
||||||
|
home = getenv("HOME");
|
||||||
|
if (home == 0) {
|
||||||
|
cerr << endl << "**ERROR** couldn't obtain $HOME." << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// first check that $HOME/.musrfit exists and if NOT create it
|
||||||
|
struct stat info;
|
||||||
|
|
||||||
|
sprintf(startup_path_name, "%s/.musrfit", home);
|
||||||
|
if (!stat(startup_path_name, &info)) {
|
||||||
|
if (!(info.st_mode & S_IFDIR))
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if (mkdir(startup_path_name, 0777)) {
|
||||||
|
cerr << endl << "**ERROR** couldn't create '" << startup_path_name << "'" << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set path-name for musrfit_startup.xml
|
||||||
|
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
|
||||||
|
|
||||||
|
ofstream fout(startup_path_name, ofstream::out);
|
||||||
|
if (!fout.is_open()) {
|
||||||
|
cerr << endl << "**ERROR** couldn't open '" << startup_path_name << "' for writing." << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// write default musrfit_startup.xml
|
||||||
|
fout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
|
||||||
|
fout << "<musrfit xmlns=\"http://lmu.web.psi.ch/musrfit/user/MUSR/WebHome.html\">" << endl;
|
||||||
|
fout << " <comment>" << endl;
|
||||||
|
fout << " Defines default settings for the musrfit package" << endl;
|
||||||
|
fout << " </comment>" << endl;
|
||||||
|
fout << " <data_path>/mnt/data/nemu/his</data_path>" << endl;
|
||||||
|
fout << " <data_path>/mnt/data/nemu/wkm</data_path>" << endl;
|
||||||
|
fout << " <data_path>/afs/psi.ch/project/nemu/data/his</data_path>" << endl;
|
||||||
|
fout << " <data_path>/afs/psi.ch/project/nemu/data/wkm</data_path>" << endl;
|
||||||
|
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/gps</data_path>" << endl;
|
||||||
|
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/dolly</data_path>" << endl;
|
||||||
|
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/gpd</data_path>" << endl;
|
||||||
|
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/ltf</data_path>" << endl;
|
||||||
|
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/alc</data_path>" << endl;
|
||||||
|
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/hifi</data_path>" << endl;
|
||||||
|
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/lem</data_path>" << endl;
|
||||||
|
fout << " <fourier_settings>" << endl;
|
||||||
|
fout << " <units>Gauss</units>" << endl;
|
||||||
|
fout << " <fourier_power>0</fourier_power>" << endl;
|
||||||
|
fout << " <apodization>none</apodization>" << endl;
|
||||||
|
fout << " <plot>real_and_imag</plot>" << endl;
|
||||||
|
fout << " <phase>0.0</phase>" << endl;
|
||||||
|
fout << " <phase_increment>1.0</phase_increment>" << endl;
|
||||||
|
fout << " </fourier_settings>" << endl;
|
||||||
|
fout << " <root_settings>" << endl;
|
||||||
|
fout << " <marker_list>" << endl;
|
||||||
|
fout << " <!-- Root marker numbers -->" << endl;
|
||||||
|
fout << " <marker>24</marker> <!-- open circle -->" << endl;
|
||||||
|
fout << " <marker>25</marker> <!-- open square -->" << endl;
|
||||||
|
fout << " <marker>26</marker> <!-- open triangle -->" << endl;
|
||||||
|
fout << " <marker>27</marker> <!-- open diamond -->" << endl;
|
||||||
|
fout << " <marker>28</marker> <!-- open cross -->" << endl;
|
||||||
|
fout << " <marker>29</marker> <!-- full star -->" << endl;
|
||||||
|
fout << " <marker>30</marker> <!-- open star -->" << endl;
|
||||||
|
fout << " <marker>20</marker> <!-- full circle -->" << endl;
|
||||||
|
fout << " <marker>21</marker> <!-- full square -->" << endl;
|
||||||
|
fout << " <marker>22</marker> <!-- full triangle -->" << endl;
|
||||||
|
fout << " <marker>23</marker> <!-- full triangle down -->" << endl;
|
||||||
|
fout << " <marker>2</marker> <!-- thin cross -->" << endl;
|
||||||
|
fout << " <marker>3</marker> <!-- thin star -->" << endl;
|
||||||
|
fout << " <marker>5</marker> <!-- thin x -->" << endl;
|
||||||
|
fout << " </marker_list>" << endl;
|
||||||
|
fout << " <color_list>" << endl;
|
||||||
|
fout << " <!-- Color as RGB coded string -->" << endl;
|
||||||
|
fout << " <color>0,0,0</color> <!-- kBlack -->" << endl;
|
||||||
|
fout << " <color>255,0,0</color> <!-- kRed -->" << endl;
|
||||||
|
fout << " <color>0,255,0</color> <!-- kGreen -->" << endl;
|
||||||
|
fout << " <color>0,0,255</color> <!-- kBlue -->" << endl;
|
||||||
|
fout << " <color>255,0,255</color> <!-- kMagenta -->" << endl;
|
||||||
|
fout << " <color>0,255,255</color> <!-- kCyan -->" << endl;
|
||||||
|
fout << " <color>153,0,255</color> <!-- kViolet-3 -->" << endl;
|
||||||
|
fout << " <color>102,102,51</color> <!-- kYellow-1 -->" << endl;
|
||||||
|
fout << " <color>51,102,51</color> <!-- kGreen-1 -->" << endl;
|
||||||
|
fout << " <color>153,0,0</color> <!-- kRed+2 -->" << endl;
|
||||||
|
fout << " </color_list>" << endl;
|
||||||
|
fout << " </root_settings>" << endl;
|
||||||
|
fout << "</musrfit>" << endl;
|
||||||
|
|
||||||
|
fout.close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// end
|
// end
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
@ -94,6 +94,7 @@ class PStartupHandler : public TObject, public TQObject
|
|||||||
PIntVector fColorList; ///< color list
|
PIntVector fColorList; ///< color list
|
||||||
|
|
||||||
Bool_t StartupFileExists(Char_t *fln);
|
Bool_t StartupFileExists(Char_t *fln);
|
||||||
|
Bool_t WriteDefaulStartupFile();
|
||||||
|
|
||||||
ClassDef(PStartupHandler, 1)
|
ClassDef(PStartupHandler, 1)
|
||||||
};
|
};
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<musrfit xmlns="http://lmu.web.psi.ch/musrfit/user/MUSR/WebHome.html">
|
|
||||||
<comment>
|
|
||||||
Defines default settings for the musrfit package
|
|
||||||
</comment>
|
|
||||||
<data_path>/mnt/data/nemu/his</data_path>
|
|
||||||
<data_path>/mnt/data/nemu/wkm</data_path>
|
|
||||||
<data_path>/afs/psi.ch/project/nemu/data/his</data_path>
|
|
||||||
<data_path>/afs/psi.ch/project/nemu/data/wkm</data_path>
|
|
||||||
<data_path>/afs/psi.ch/project/bulkmusr/data/gps</data_path>
|
|
||||||
<data_path>/afs/psi.ch/project/bulkmusr/data/dolly</data_path>
|
|
||||||
<data_path>/afs/psi.ch/project/bulkmusr/data/gpd</data_path>
|
|
||||||
<data_path>/afs/psi.ch/project/bulkmusr/data/ltf</data_path>
|
|
||||||
<data_path>/afs/psi.ch/project/bulkmusr/data/alc</data_path>
|
|
||||||
<data_path>/afs/psi.ch/project/bulkmusr/data/hifi</data_path>
|
|
||||||
<data_path>/afs/psi.ch/project/bulkmusr/data/lem</data_path>
|
|
||||||
<fourier_settings>
|
|
||||||
<units>Gauss</units>
|
|
||||||
<fourier_power>0</fourier_power>
|
|
||||||
<apodization>none</apodization>
|
|
||||||
<plot>real_and_imag</plot>
|
|
||||||
<phase>0.0</phase>
|
|
||||||
<phase_increment>1.0</phase_increment>
|
|
||||||
</fourier_settings>
|
|
||||||
<root_settings>
|
|
||||||
<marker_list>
|
|
||||||
<!-- Root marker numbers -->
|
|
||||||
<marker>24</marker> <!-- open circle -->
|
|
||||||
<marker>25</marker> <!-- open square -->
|
|
||||||
<marker>26</marker> <!-- open triangle -->
|
|
||||||
<marker>27</marker> <!-- open diamond -->
|
|
||||||
<marker>28</marker> <!-- open cross -->
|
|
||||||
<marker>29</marker> <!-- full star -->
|
|
||||||
<marker>30</marker> <!-- open star -->
|
|
||||||
<marker>20</marker> <!-- full circle -->
|
|
||||||
<marker>21</marker> <!-- full square -->
|
|
||||||
<marker>22</marker> <!-- full triangle -->
|
|
||||||
<marker>23</marker> <!-- full triangle down -->
|
|
||||||
<marker>2</marker> <!-- thin cross -->
|
|
||||||
<marker>3</marker> <!-- thin star -->
|
|
||||||
<marker>5</marker> <!-- thin x -->
|
|
||||||
</marker_list>
|
|
||||||
<color_list>
|
|
||||||
<!-- Color as RGB coded string -->
|
|
||||||
<color>0,0,0</color> <!-- kBlack -->
|
|
||||||
<color>255,0,0</color> <!-- kRed -->
|
|
||||||
<color>0,255,0</color> <!-- kGreen -->
|
|
||||||
<color>0,0,255</color> <!-- kBlue -->
|
|
||||||
<color>255,0,255</color> <!-- kMagenta -->
|
|
||||||
<color>0,255,255</color> <!-- kCyan -->
|
|
||||||
<color>153,0,255</color> <!-- kViolet-3 -->
|
|
||||||
<color>102,102,51</color> <!-- kYellow-1 -->
|
|
||||||
<color>51,102,51</color> <!-- kGreen-1 -->
|
|
||||||
<color>153,0,0</color> <!-- kRed+2 -->
|
|
||||||
</color_list>
|
|
||||||
</root_settings>
|
|
||||||
</musrfit>
|
|
Reference in New Issue
Block a user