From a5e9191f15b8e06606d87583ea992e0876fa2441 Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Thu, 25 Feb 2016 18:19:29 +0100 Subject: [PATCH 1/3] centralize more XML startup files. --- src/external/Nonlocal/Makefile.am | 10 ++++++++++ src/external/Nonlocal/PNL_StartupHandler.cpp | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/external/Nonlocal/Makefile.am b/src/external/Nonlocal/Makefile.am index 0cdeadfe..65aa2c55 100644 --- a/src/external/Nonlocal/Makefile.am +++ b/src/external/Nonlocal/Makefile.am @@ -62,3 +62,13 @@ install-exec-hook: uninstall-hook: rm -f $(libdir)/libPNL_PippardFitter.so endif + +xmldir = $(HOME)/.musrfit/external +xml_DATA = nonlocal_startup.xml + +install-xml_DATA: $(xml_DATA) + $(INSTALL_DATA) '$(xml_DATA)' '$xmldir' + +uninstall-xml_DATA: $(xml_DATA) + $(RM) '$(xml_DATA)' '$xmldir' + diff --git a/src/external/Nonlocal/PNL_StartupHandler.cpp b/src/external/Nonlocal/PNL_StartupHandler.cpp index cd32a43a..a5b8aa08 100644 --- a/src/external/Nonlocal/PNL_StartupHandler.cpp +++ b/src/external/Nonlocal/PNL_StartupHandler.cpp @@ -56,7 +56,8 @@ PNL_StartupHandler::PNL_StartupHandler() fTrimSpDataPath = TString(""); // get default path (for the moment only linux like) - char startup_path_name[128]; + char startup_path_name[512]; + char *home_str; // check if the startup file is found in the current directory strcpy(startup_path_name, "./nonlocal_startup.xml"); @@ -65,7 +66,8 @@ PNL_StartupHandler::PNL_StartupHandler() fStartupFilePath = TString(startup_path_name); } else { // startup file is not found in the current directory cout << endl << "PNL_StartupHandler(): **WARNING** Couldn't find nonlocal_startup.xml in the current directory, will try default one." << endl; - strncpy(startup_path_name, "/home/nemu/analysis/musrfit/src/external/Nonlocal/nonlocal_startup.xml", sizeof(startup_path_name)); + home_str = getenv("$HOME"); + snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/nonlocal_startup.xml", home_str); if (StartupFileExists(startup_path_name)) { fStartupFileFound = true; fStartupFilePath = TString(startup_path_name); From 4d2d7c860e207e6b89901b6476180c01150cdee2 Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Thu, 25 Feb 2016 21:07:30 +0100 Subject: [PATCH 2/3] more work towards centralizing default startup XML files. --- src/external/Nonlocal/PNL_StartupHandler.cpp | 6 ++---- src/external/libPhotoMeissner/classes/Makefile.am | 11 +++++++++++ .../libPhotoMeissner/classes/PStartupHandler_PM.cpp | 6 ++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/external/Nonlocal/PNL_StartupHandler.cpp b/src/external/Nonlocal/PNL_StartupHandler.cpp index a5b8aa08..f69e7955 100644 --- a/src/external/Nonlocal/PNL_StartupHandler.cpp +++ b/src/external/Nonlocal/PNL_StartupHandler.cpp @@ -5,8 +5,6 @@ Author: Andreas Suter e-mail: andreas.suter@psi.ch - $Id$ - ***************************************************************************/ /*************************************************************************** @@ -57,7 +55,7 @@ PNL_StartupHandler::PNL_StartupHandler() // get default path (for the moment only linux like) char startup_path_name[512]; - char *home_str; + char *home_str=0; // check if the startup file is found in the current directory strcpy(startup_path_name, "./nonlocal_startup.xml"); @@ -66,7 +64,7 @@ PNL_StartupHandler::PNL_StartupHandler() fStartupFilePath = TString(startup_path_name); } else { // startup file is not found in the current directory cout << endl << "PNL_StartupHandler(): **WARNING** Couldn't find nonlocal_startup.xml in the current directory, will try default one." << endl; - home_str = getenv("$HOME"); + home_str = getenv("HOME"); snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/nonlocal_startup.xml", home_str); if (StartupFileExists(startup_path_name)) { fStartupFileFound = true; diff --git a/src/external/libPhotoMeissner/classes/Makefile.am b/src/external/libPhotoMeissner/classes/Makefile.am index 38c8e8df..db00e9ae 100644 --- a/src/external/libPhotoMeissner/classes/Makefile.am +++ b/src/external/libPhotoMeissner/classes/Makefile.am @@ -59,3 +59,14 @@ install-exec-hook: uninstall-hook: rm -f $(libdir)/libPPhotoMeissner.so endif + +# define default xml install +xmldir = $(HOME)/.musrfit/external +xml_DATA = ../test/photoMeissner_startup.xml + +instal-xml_DATA: $(xml_DATA) + $(INSTALL_DATA) '$(xml_DATA)' '$(xmldir)' + +uninstal-xml_DATA: $(xml_DATA) + $(RM) '$(xml_DATA)' '$(xmldir)' + diff --git a/src/external/libPhotoMeissner/classes/PStartupHandler_PM.cpp b/src/external/libPhotoMeissner/classes/PStartupHandler_PM.cpp index 30530b29..a0f4d491 100644 --- a/src/external/libPhotoMeissner/classes/PStartupHandler_PM.cpp +++ b/src/external/libPhotoMeissner/classes/PStartupHandler_PM.cpp @@ -231,7 +231,8 @@ PStartupHandler_PM::PStartupHandler_PM() fStartupFilePath = ""; // get default path (for the moment only linux like) - char startup_path_name[128]; + char startup_path_name[512]; + char *home_path=0; // check if the startup file is found in the current directory strcpy(startup_path_name, "./photoMeissner_startup.xml"); @@ -240,7 +241,8 @@ PStartupHandler_PM::PStartupHandler_PM() fStartupFilePath = TString(startup_path_name); } else { // startup file is not found in the current directory cout << endl << ">> PStartupHandler_PM(): **WARNING** Couldn't find photoMeissner_startup.xml in the current directory, will try default one." << endl; - strncpy(startup_path_name, "/home/nemu/analysis/musrfit/src/external/libPhotoMeissner/test/photoMeissner_startup.xml", sizeof(startup_path_name)); + home_path = getenv("HOME"); + snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/external/photoMeissner_startup.xml", home_path); if (StartupFileExists(startup_path_name)) { fStartupFileFound = true; fStartupFilePath = TString(startup_path_name); From 3ff1bebd9da386c9bccdad2f8cf8ca39e7ecf6ee Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Fri, 26 Feb 2016 08:30:50 +0100 Subject: [PATCH 3/3] centralize XML startup files --- src/external/libPhotoMeissner/classes/Makefile.am | 2 +- src/external/libSpinValve/classes/Makefile.am | 13 ++++++++++++- .../libSpinValve/classes/PStartupHandler_SV.cpp | 6 ++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/external/libPhotoMeissner/classes/Makefile.am b/src/external/libPhotoMeissner/classes/Makefile.am index db00e9ae..759aafcf 100644 --- a/src/external/libPhotoMeissner/classes/Makefile.am +++ b/src/external/libPhotoMeissner/classes/Makefile.am @@ -28,7 +28,7 @@ AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS) BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources) AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@ -CLEANFILES = ../include/*Dict.cpp ../include/*Dict.h *~ core +CLEANFILES = ../classes/*Dict* ../include/*Dict.* *~ core %Dict.cpp %Dict.h: ../include/%.h ../include/%LinkDef.h @ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^ diff --git a/src/external/libSpinValve/classes/Makefile.am b/src/external/libSpinValve/classes/Makefile.am index a9a58527..544d7c39 100644 --- a/src/external/libSpinValve/classes/Makefile.am +++ b/src/external/libSpinValve/classes/Makefile.am @@ -28,7 +28,7 @@ AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS) BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources) AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@ -CLEANFILES = ../include/*Dict.cpp ../include/*Dict.h *~ core +CLEANFILES = ../classes/*Dict.* ../include/*Dict.* *~ core %Dict.cpp %Dict.h: ../include/%.h ../include/%LinkDef.h @ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^ @@ -59,3 +59,14 @@ install-exec-hook: uninstall-hook: rm -f $(libdir)/libPSpinValve.so endif + +# define default xml install +xmldir = $(HOME)/.musrfit/external +xml_DATA = ../test/spinValve_startup.xml + +instal-xml_DATA: $(xml_DATA) + $(INSTALL_DATA) '$(xml_DATA)' '$(xmldir)' + +uninstal-xml_DATA: $(xml_DATA) + $(RM) '$(xml_DATA)' '$(xmldir)' + diff --git a/src/external/libSpinValve/classes/PStartupHandler_SV.cpp b/src/external/libSpinValve/classes/PStartupHandler_SV.cpp index 9252f5a1..b13bdd4a 100644 --- a/src/external/libSpinValve/classes/PStartupHandler_SV.cpp +++ b/src/external/libSpinValve/classes/PStartupHandler_SV.cpp @@ -52,6 +52,7 @@ PStartupHandler_SV::PStartupHandler_SV() // get default path (for the moment only linux like) char startup_path_name[128]; + char *home_path=0; // check if the startup file is found in the current directory strcpy(startup_path_name, "./spinValve_startup.xml"); @@ -59,8 +60,9 @@ PStartupHandler_SV::PStartupHandler_SV() fStartupFileFound = true; fStartupFilePath = TString(startup_path_name); } else { // startup file is not found in the current directory - cout << endl << ">> PStartupHandler_SV(): **WARNING** Couldn't find skewedLorentzian_startup.xml in the current directory, will try default one." << endl; - strncpy(startup_path_name, "/home/nemu/analysis/musrfit/src/external/libSpinValve/test/spinValve_startup.xml", sizeof(startup_path_name)); + cout << endl << ">> PStartupHandler_SV(): **WARNING** Couldn't find spinValve_startup.xml in the current directory, will try default one." << endl; + home_path = getenv("HOME"); + snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/external/spinValve_startup.xml", home_path); if (StartupFileExists(startup_path_name)) { fStartupFileFound = true; fStartupFilePath = TString(startup_path_name);