changeset 181:c96f5f64c946

Armonize configuration file path construction in KK data provider
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Fri, 21 Feb 2014 18:42:29 +0100
parents 8faada7e4faf
children 4d1f9e222e9e
files kk-data-provider.c
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/kk-data-provider.c	Fri Feb 21 18:42:16 2014 +0100
+++ b/kk-data-provider.c	Fri Feb 21 18:42:29 2014 +0100
@@ -6,10 +6,10 @@
 #include <utility.h>
 #include <inifile.h>
 
+#include "config.h"
 #include "data-provider.h"
 #include "KKFX80E.h"
 
-#define CONFIGFILE "FXAnalyse.ini"
 #define DEFAULT_PORT "COM4:115200"
 #define DEFAULT_NCHAN 4
 #define TIMEOUT 1 /* seconds */
@@ -28,22 +28,20 @@
 	/* get main thread id to post messages to it */
 	mainThreadId = CmtGetMainThreadID();
 	
-	/* construct configuration file path */ 
-	char pathname[MAX_PATHNAME_LEN];
-	char project[MAX_PATHNAME_LEN];
-	GetProjectDir(project); 
-	MakePathname(project, CONFIGFILE, pathname);
+	/* configuration file path */ 
+	char path[MAX_PATHNAME_LEN];
+	GetIniFilePath(path); 
 
 	/* load configuration file */ 
 	IniText configuration = Ini_New(TRUE);
-	Ini_ReadFromFile(configuration, pathname);
+	Ini_ReadFromFile(configuration, path);
 
 	/* get serial port name configuration */
 	rv = Ini_GetStringIntoBuffer(configuration, "KK", "port", port, sizeof(port));
 	if (! rv)
 		strncpy(port, DEFAULT_PORT, sizeof(port));
 	
-	/* channels number */
+	/* channel number */
 	rv = Ini_GetInt(configuration, "KK", "nchan", &nchan);
 	if (! rv)
 		nchan = DEFAULT_NCHAN;