[aseprite] 46/51: Expand filename wildcards in command line on Windows (fix #1049)

Tobias Hansen thansen at moszumanska.debian.org
Mon Jul 11 21:35:19 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 92084fe14ad6756c433cab6d5c358fa7d9dfa5ed
Author: David Capello <davidcapello at gmail.com>
Date:   Wed Jul 6 15:19:14 2016 -0300

    Expand filename wildcards in command line on Windows (fix #1049)
---
 src/CMakeLists.txt   |  6 ++++++
 src/she/skia/she.cpp | 16 +++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ea20b2d..34d830f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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)
 
diff --git a/src/she/skia/she.cpp b/src/she/skia/she.cpp
index 833a0da..a6be689 100644
--- a/src/she/skia/she.cpp
+++ b/src/she/skia/she.cpp
@@ -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[]) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list