diff options
author | Antoine ELIAS <antoine.elias@scilab-enterprises.com> | 2016-11-10 08:25:19 +0100 |
---|---|---|
committer | Antoine ELIAS <antoine.elias@scilab-enterprises.com> | 2016-11-10 08:25:19 +0100 |
commit | 4ad1c509e77194b3b3d16c6d756659ad8d587ff9 (patch) | |
tree | 1d93b691aaf63020f39f8fd5a061a97ea55ccd45 | |
parent | bab474978d0f2bf1ebb41f88abe8504508e62790 (diff) | |
download | scilab-4ad1c509e77194b3b3d16c6d756659ad8d587ff9.zip scilab-4ad1c509e77194b3b3d16c6d756659ad8d587ff9.tar.gz |
utf: windows_tools 2
Change-Id: I32744575877cafee7ac9db32902f3f12dbf31040
4 files changed, 40 insertions, 48 deletions
diff --git a/scilab/modules/windows_tools/sci_gateway/cpp/sci_winopen.cpp b/scilab/modules/windows_tools/sci_gateway/cpp/sci_winopen.cpp index 8482f44..d01f86a 100644 --- a/scilab/modules/windows_tools/sci_gateway/cpp/sci_winopen.cpp +++ b/scilab/modules/windows_tools/sci_gateway/cpp/sci_winopen.cpp | |||
@@ -57,7 +57,7 @@ types::Function::ReturnValue sci_winopen(types::typed_list &in, int _iRetCount, | |||
57 | } | 57 | } |
58 | else | 58 | else |
59 | { | 59 | { |
60 | Scierror(999, _("%s: Cannot open file %ls.\n"), fname.data(), pS->get()[0]); | 60 | Scierror(999, _("%s: Cannot open file %s.\n"), fname.data(), pS->get()[0]); |
61 | return types::Function::Error; | 61 | return types::Function::Error; |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/scilab/modules/windows_tools/src/c/scilab_windows/FilesAssociations.c b/scilab/modules/windows_tools/src/c/scilab_windows/FilesAssociations.c index 8caa862..2152274 100644 --- a/scilab/modules/windows_tools/src/c/scilab_windows/FilesAssociations.c +++ b/scilab/modules/windows_tools/src/c/scilab_windows/FilesAssociations.c | |||
@@ -152,7 +152,7 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd) | |||
152 | { | 152 | { |
153 | if (!HaveAnotherWindowScilab() || haveMutexClosingScilab()) | 153 | if (!HaveAnotherWindowScilab() || haveMutexClosingScilab()) |
154 | { | 154 | { |
155 | if (with_module(L"scinotes")) | 155 | if (with_module("scinotes")) |
156 | { | 156 | { |
157 | wsprintf(Cmd, MSG_SCIMSG5_EDITOR, PathWScilex, FinalFileName); | 157 | wsprintf(Cmd, MSG_SCIMSG5_EDITOR, PathWScilex, FinalFileName); |
158 | } | 158 | } |
@@ -166,7 +166,7 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd) | |||
166 | { | 166 | { |
167 | char *ScilabDestination = NULL; | 167 | char *ScilabDestination = NULL; |
168 | 168 | ||
169 | if (with_module(L"scinotes")) | 169 | if (with_module("scinotes")) |
170 | { | 170 | { |
171 | wsprintf(Cmd, MSG_SCIMSG6_EDITOR, FinalFileName); | 171 | wsprintf(Cmd, MSG_SCIMSG6_EDITOR, FinalFileName); |
172 | } | 172 | } |
@@ -185,7 +185,7 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd) | |||
185 | } | 185 | } |
186 | else | 186 | else |
187 | { | 187 | { |
188 | if (with_module(L"scinotes")) | 188 | if (with_module("scinotes")) |
189 | { | 189 | { |
190 | wsprintf(Cmd, MSG_SCIMSG5_EDITOR, PathWScilex, FinalFileName); | 190 | wsprintf(Cmd, MSG_SCIMSG5_EDITOR, PathWScilex, FinalFileName); |
191 | } | 191 | } |
@@ -213,7 +213,7 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd) | |||
213 | ExtensionFileIntoLowerCase(FinalFileName); | 213 | ExtensionFileIntoLowerCase(FinalFileName); |
214 | if (!HaveAnotherWindowScilab() || haveMutexClosingScilab()) | 214 | if (!HaveAnotherWindowScilab() || haveMutexClosingScilab()) |
215 | { | 215 | { |
216 | if (with_module(L"xcos")) | 216 | if (with_module("xcos")) |
217 | { | 217 | { |
218 | wsprintf(Cmd, MSG_SCIMSG2_XCOS, PathWScilex, FinalFileName); | 218 | wsprintf(Cmd, MSG_SCIMSG2_XCOS, PathWScilex, FinalFileName); |
219 | } | 219 | } |
@@ -227,7 +227,7 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd) | |||
227 | { | 227 | { |
228 | char *ScilabDestination = NULL; | 228 | char *ScilabDestination = NULL; |
229 | 229 | ||
230 | if (with_module(L"xcos")) | 230 | if (with_module("xcos")) |
231 | { | 231 | { |
232 | wsprintf(Cmd, MSG_SCIMSG3_XCOS, FinalFileName); | 232 | wsprintf(Cmd, MSG_SCIMSG3_XCOS, FinalFileName); |
233 | } | 233 | } |
@@ -246,7 +246,7 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd) | |||
246 | } | 246 | } |
247 | else | 247 | else |
248 | { | 248 | { |
249 | if (with_module(L"xcos")) | 249 | if (with_module("xcos")) |
250 | { | 250 | { |
251 | wsprintf(Cmd, MSG_SCIMSG2_XCOS, PathWScilex, FinalFileName); | 251 | wsprintf(Cmd, MSG_SCIMSG2_XCOS, PathWScilex, FinalFileName); |
252 | } | 252 | } |
diff --git a/scilab/modules/windows_tools/src/cpp/scilab_windows/SetScilabEnvironmentVariables.cpp b/scilab/modules/windows_tools/src/cpp/scilab_windows/SetScilabEnvironmentVariables.cpp index d0e65a1..bd07cb4 100644 --- a/scilab/modules/windows_tools/src/cpp/scilab_windows/SetScilabEnvironmentVariables.cpp +++ b/scilab/modules/windows_tools/src/cpp/scilab_windows/SetScilabEnvironmentVariables.cpp | |||
@@ -117,33 +117,25 @@ BOOL Set_SCI_PATH(char *DefaultPath) | |||
117 | /*--------------------------------------------------------------------------*/ | 117 | /*--------------------------------------------------------------------------*/ |
118 | BOOL Set_HOME_PATH(char *DefaultPath) | 118 | BOOL Set_HOME_PATH(char *DefaultPath) |
119 | { | 119 | { |
120 | wchar_t *wHOME = _wgetenv(L"HOME"); | 120 | char *HOME = getenv("HOME"); |
121 | if (wHOME == NULL) | 121 | if (HOME == NULL) |
122 | { | 122 | { |
123 | wchar_t *wUserProfile = _wgetenv(L"USERPROFILE"); | 123 | char* UserProfile = getenv("USERPROFILE"); |
124 | if (wUserProfile) | 124 | if (UserProfile) |
125 | { | 125 | { |
126 | return SetEnvironmentVariableW(L"HOME", wUserProfile); | 126 | return SetEnvironmentVariableA("HOME", UserProfile); |
127 | } | 127 | } |
128 | else | 128 | else |
129 | { | 129 | { |
130 | /* if USERPROFILE is not defined , we use default profile */ | 130 | /* if USERPROFILE is not defined , we use default profile */ |
131 | wchar_t *wAllUsersProfile = _wgetenv(L"ALLUSERSPROFILE"); | 131 | char *AllUsersProfile = getenv("ALLUSERSPROFILE"); |
132 | if (wAllUsersProfile) | 132 | if (AllUsersProfile) |
133 | { | 133 | { |
134 | return SetEnvironmentVariableW(L"HOME", wUserProfile); | 134 | return SetEnvironmentVariableA("HOME", UserProfile); |
135 | } | 135 | } |
136 | else | 136 | else |
137 | { | 137 | { |
138 | BOOL bRes = FALSE; | 138 | return SetEnvironmentVariableA("HOME", DefaultPath); |
139 | wchar_t *wDefault = to_wide_string(DefaultPath); | ||
140 | if (wDefault) | ||
141 | { | ||
142 | bRes = SetEnvironmentVariableW(L"HOME", wDefault); | ||
143 | FREE(wDefault); | ||
144 | wDefault = NULL; | ||
145 | } | ||
146 | return bRes; | ||
147 | } | 139 | } |
148 | } | 140 | } |
149 | } | 141 | } |
diff --git a/scilab/modules/windows_tools/src/cpp/scilab_windows/getScilabDirectory.cpp b/scilab/modules/windows_tools/src/cpp/scilab_windows/getScilabDirectory.cpp index ccf5c8c..26facf1 100644 --- a/scilab/modules/windows_tools/src/cpp/scilab_windows/getScilabDirectory.cpp +++ b/scilab/modules/windows_tools/src/cpp/scilab_windows/getScilabDirectory.cpp | |||
@@ -26,58 +26,58 @@ extern "C" | |||
26 | char *getScilabDirectory(BOOL UnixStyle) | 26 | char *getScilabDirectory(BOOL UnixStyle) |
27 | { | 27 | { |
28 | char *SciPathName = NULL; | 28 | char *SciPathName = NULL; |
29 | wchar_t* wcSciPathName = NULL; | 29 | char* cSciPathName = NULL; |
30 | wchar_t ScilabModuleName[MAX_PATH + 1]; | 30 | char ScilabModuleName[MAX_PATH + 1]; |
31 | wchar_t drive[_MAX_DRIVE]; | 31 | char drive[_MAX_DRIVE]; |
32 | wchar_t dir[_MAX_DIR]; | 32 | char dir[_MAX_DIR]; |
33 | wchar_t fname[_MAX_FNAME]; | 33 | char fname[_MAX_FNAME]; |
34 | wchar_t ext[_MAX_EXT]; | 34 | char ext[_MAX_EXT]; |
35 | wchar_t *DirTmp = NULL; | 35 | char *DirTmp = NULL; |
36 | 36 | ||
37 | 37 | ||
38 | if (!GetModuleFileNameW ((HINSTANCE)GetModuleHandleW(L"core"), (wchar_t*) ScilabModuleName, MAX_PATH)) | 38 | if (!GetModuleFileNameA((HINSTANCE)GetModuleHandleA("core"), ScilabModuleName, MAX_PATH)) |
39 | { | 39 | { |
40 | return NULL; | 40 | return NULL; |
41 | } | 41 | } |
42 | 42 | ||
43 | os_wsplitpath(ScilabModuleName, drive, dir, fname, ext); | 43 | os_splitpath(ScilabModuleName, drive, dir, fname, ext); |
44 | 44 | ||
45 | if (dir[wcslen(dir) - 1] == L'\\') | 45 | if (dir[strlen(dir) - 1] == '\\') |
46 | { | 46 | { |
47 | dir[wcslen(dir) - 1] = L'\0'; | 47 | dir[strlen(dir) - 1] = '\0'; |
48 | } | 48 | } |
49 | 49 | ||
50 | DirTmp = wcsrchr (dir, L'\\'); | 50 | DirTmp = strrchr (dir, '\\'); |
51 | 51 | ||
52 | if (wcslen(dir) - wcslen(DirTmp) > 0) | 52 | if (strlen(dir) - strlen(DirTmp) > 0) |
53 | { | 53 | { |
54 | dir[wcslen(dir) - wcslen(DirTmp)] = L'\0'; | 54 | dir[strlen(dir) - strlen(DirTmp)] = '\0'; |
55 | } | 55 | } |
56 | else | 56 | else |
57 | { | 57 | { |
58 | return NULL; | 58 | return NULL; |
59 | } | 59 | } |
60 | 60 | ||
61 | wcSciPathName = (wchar_t*)MALLOC((int)( wcslen(drive) + wcslen(dir) + 5) * sizeof(wchar_t)); | 61 | cSciPathName = (char*)MALLOC((int)(strlen(drive) + strlen(dir) + 5) * sizeof(char)); |
62 | if (wcSciPathName) | 62 | if (cSciPathName) |
63 | { | 63 | { |
64 | _wmakepath(wcSciPathName, drive, dir, NULL, NULL); | 64 | _makepath(cSciPathName, drive, dir, NULL, NULL); |
65 | if ( UnixStyle ) | 65 | if ( UnixStyle ) |
66 | { | 66 | { |
67 | int i = 0; | 67 | int i = 0; |
68 | for (i = 0; i < (int)wcslen(wcSciPathName); i++) | 68 | for (i = 0; i < (int)strlen(cSciPathName); i++) |
69 | { | 69 | { |
70 | if (wcSciPathName[i] == L'\\') | 70 | if (cSciPathName[i] == '\\') |
71 | { | 71 | { |
72 | wcSciPathName[i] = L'/'; | 72 | cSciPathName[i] = '/'; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | } | 75 | } |
76 | wcSciPathName[wcslen(wcSciPathName) - 1] = '\0'; | 76 | cSciPathName[strlen(cSciPathName) - 1] = '\0'; |
77 | 77 | ||
78 | SciPathName = wide_string_to_UTF8(wcSciPathName); | 78 | SciPathName = os_strdup(cSciPathName); |
79 | FREE(wcSciPathName); | 79 | FREE(cSciPathName); |
80 | wcSciPathName = NULL; | 80 | cSciPathName = NULL; |
81 | } | 81 | } |
82 | 82 | ||
83 | if (SciPathName) | 83 | if (SciPathName) |