mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
85f3084e21
commit
e5565891af
@ -10,6 +10,11 @@ if(USE_GCOV)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# tell MinGW compiler to enable wmain
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -municode")
|
||||
endif()
|
||||
|
||||
set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches)
|
||||
set(GENERATOR_DIR ${CMAKE_CURRENT_LIST_DIR}/generators)
|
||||
set(GENERATED_DIR ${PROJECT_BINARY_DIR}/src/nvim/auto)
|
||||
|
@ -7,6 +7,11 @@
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef WIN32
|
||||
# include <wchar.h>
|
||||
# include <winnls.h>
|
||||
#endif
|
||||
|
||||
#include <msgpack.h>
|
||||
|
||||
#include "nvim/ascii.h"
|
||||
@ -215,10 +220,28 @@ void early_init(void)
|
||||
|
||||
#ifdef MAKE_LIB
|
||||
int nvim_main(int argc, char **argv)
|
||||
#elif defined WIN32
|
||||
// don't use codepage encoded arguments. see #7060
|
||||
int wmain(int argc, wchar_t **argv_w)
|
||||
#else
|
||||
int main(int argc, char **argv)
|
||||
#endif
|
||||
{
|
||||
#ifdef WIN32
|
||||
char *argv[argc];
|
||||
|
||||
for (size_t i = 0; i < (size_t)argc; i++) {
|
||||
// get required buffer size
|
||||
size_t dest_size = (size_t)WideCharToMultiByte(
|
||||
CP_UTF8, 0, argv_w[i], -1, NULL, 0, NULL, NULL);
|
||||
char *buf = (char *)xmallocz(dest_size);
|
||||
// convert from utf16 (widechar) utf8 (multibyte)
|
||||
WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, buf, (int)dest_size,
|
||||
NULL, NULL);
|
||||
argv[i] = buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
argv0 = argv[0];
|
||||
|
||||
char_u *fname = NULL; // file name from command line
|
||||
|
Loading…
Reference in New Issue
Block a user