Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
windows: use "windows" instead of "win32"
Because we also support win64.
- Loading branch information
Showing
10 changed files
with
145 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| Copyright(C) 2015 Brazil | ||
| This library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2.1 of the License, or (at your option) any later version. | ||
| This library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
| You should have received a copy of the GNU Lesser General Public | ||
| License along with this library; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| */ | ||
|
|
||
| #ifndef GROONGA_WINDOWS_H | ||
| #define GROONGA_WINDOWS_H | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #ifdef WIN32 | ||
| GRN_API const char *grn_windows_base_dir(void); | ||
| #endif /* WIN32 */ | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* GROONGA_WINDOWS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,4 +76,5 @@ libgroonga_la_SOURCES = \ | |
| token_filter.c \ | ||
| util.c \ | ||
| grn_util.h \ | ||
| windows.c \ | ||
| windows_event_logger.c | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* -*- c-basic-offset: 2 -*- */ | ||
| /* | ||
| Copyright(C) 2010-2015 Brazil | ||
| This library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License version 2.1 as published by the Free Software Foundation. | ||
| This library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
| You should have received a copy of the GNU Lesser General Public | ||
| License along with this library; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| */ | ||
|
|
||
| #include <groonga.h> | ||
|
|
||
| #ifdef WIN32 | ||
| static char *windows_base_dir = NULL; | ||
| const char * | ||
| grn_windows_base_dir(void) | ||
| { | ||
| if (!windows_base_dir) { | ||
| HMODULE dll; | ||
| const wchar_t *dll_filename = GRN_DLL_FILENAME; | ||
| wchar_t absolute_dll_filename[MAX_PATH]; | ||
| DWORD absolute_dll_filename_size; | ||
| dll = GetModuleHandleW(dll_filename); | ||
| absolute_dll_filename_size = GetModuleFileNameW(dll, | ||
| absolute_dll_filename, | ||
| MAX_PATH); | ||
| if (absolute_dll_filename_size == 0) { | ||
| windows_base_dir = grn_strdup_raw("."); | ||
| } else { | ||
| DWORD ansi_dll_filename_size; | ||
| ansi_dll_filename_size = | ||
| WideCharToMultiByte(CP_ACP, 0, | ||
| absolute_dll_filename, absolute_dll_filename_size, | ||
| NULL, 0, NULL, NULL); | ||
| if (ansi_dll_filename_size == 0) { | ||
| windows_base_dir = grn_strdup_raw("."); | ||
| } else { | ||
| char *path; | ||
| windows_base_dir = malloc(ansi_dll_filename_size + 1); | ||
| WideCharToMultiByte(CP_ACP, 0, | ||
| absolute_dll_filename, absolute_dll_filename_size, | ||
| windows_base_dir, ansi_dll_filename_size, | ||
| NULL, NULL); | ||
| windows_base_dir[ansi_dll_filename_size] = '\0'; | ||
| if ((path = strrchr(windows_base_dir, '\\'))) { | ||
| *path = '\0'; | ||
| } | ||
| path = strrchr(windows_base_dir, '\\'); | ||
| if (path && (grn_strcasecmp(path + 1, "bin") == 0 || | ||
| grn_strcasecmp(path + 1, "lib") == 0)) { | ||
| *path = '\0'; | ||
| } else { | ||
| path = windows_base_dir + strlen(windows_base_dir); | ||
| *path = '\0'; | ||
| } | ||
| for (path = windows_base_dir; *path; path++) { | ||
| if (*path == '\\') { | ||
| *path = '/'; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return windows_base_dir; | ||
| } | ||
| #endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters