2c0f2472f317c2e3907c01f088717437458cc22c
[scilab.git] / scilab / modules / localization / src / c / LanguagePref.c
1 /*\r
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab\r
3  * Copyright (C) 2008 - DIGITEO - Allan CORNET\r
4  * \r
5  * This file must be used under the terms of the CeCILL.\r
6  * This source file is licensed as described in the file COPYING, which\r
7  * you should have received as part of this distribution.  The terms\r
8  * are also available at    \r
9  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt\r
10  *\r
11  */\r
12 \r
13 /*--------------------------------------------------------------------------*/\r
14 #include <stdio.h>\r
15 #include "SCIHOME.h"\r
16 #include "MALLOC.h"\r
17 #include "LanguagePref.h"\r
18 /*--------------------------------------------------------------------------*/\r
19 #if _MSC_VER\r
20         #define namelanguagepref "\\language.ini"\r
21 #else\r
22         #define namelanguagepref "/.language"\r
23 #endif\r
24 /*--------------------------------------------------------------------------*/\r
25 char *getFilenameLanguagePref(void)\r
26 {\r
27         char *retFilename = NULL;\r
28         char *SCIHOME = NULL;\r
29 \r
30         SCIHOME = getSCIHOME();\r
31 \r
32         if (SCIHOME)\r
33         {\r
34                 retFilename = (char*)MALLOC( (strlen(namelanguagepref) + strlen(SCIHOME) + 1) *sizeof(char));\r
35                 sprintf(retFilename,"%s%s",SCIHOME,namelanguagepref);\r
36                 FREE(SCIHOME);\r
37                 SCIHOME = NULL;\r
38         }\r
39         else\r
40         {\r
41                 retFilename = (char*)MALLOC((strlen(namelanguagepref) + 1)*sizeof(char));\r
42                 strcpy(retFilename,namelanguagepref);\r
43         }\r
44 \r
45         return retFilename;\r
46 }\r
47 /*--------------------------------------------------------------------------*/\r