mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-01 12:39:23 +00:00
Expand filename wildcards in command line on Windows (fix #1049)
This commit is contained in:
parent
0722d95b5d
commit
92084fe14a
@ -159,6 +159,12 @@ add_executable(aseprite WIN32
|
||||
target_link_libraries(aseprite app-lib ${PLATFORM_LIBS})
|
||||
add_dependencies(aseprite copy_data)
|
||||
|
||||
if(MSVC AND USE_SKIA_BACKEND)
|
||||
# Add support to expand filename wildcards in argc/argv
|
||||
set_target_properties(aseprite
|
||||
PROPERTIES LINK_FLAGS "-LINK wsetargv.obj -ENTRY:\"wWinMainCRTStartup\"")
|
||||
endif()
|
||||
|
||||
install(TARGETS aseprite
|
||||
RUNTIME DESTINATION bin)
|
||||
|
||||
|
@ -51,20 +51,22 @@ void clear_keyboard_buffer()
|
||||
extern int app_main(int argc, char* argv[]);
|
||||
|
||||
#if _WIN32
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine, int nCmdShow) {
|
||||
int argc = 0;
|
||||
LPWSTR* argvW = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
extern int __argc;
|
||||
extern wchar_t** __wargv;
|
||||
|
||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
PWSTR lpCmdLine, int nCmdShow) {
|
||||
int argc = __argc;
|
||||
char** argv;
|
||||
if (argvW && argc > 0) {
|
||||
if (__wargv && argc > 0) {
|
||||
argv = new char*[argc];
|
||||
for (int i=0; i<argc; ++i)
|
||||
argv[i] = base_strdup(base::to_utf8(std::wstring(argvW[i])).c_str());
|
||||
LocalFree(argvW);
|
||||
argv[i] = base_strdup(base::to_utf8(std::wstring(__wargv[i])).c_str());
|
||||
}
|
||||
else {
|
||||
argv = new char*[1];
|
||||
argv[0] = base_strdup("");
|
||||
argc = 1;
|
||||
}
|
||||
#else
|
||||
int main(int argc, char* argv[]) {
|
||||
|
Loading…
Reference in New Issue
Block a user