args: call GetModuleFileName on Windows
authorgiwoong.kim <giwoong.kim@samsung.com>
Wed, 26 Dec 2012 12:26:11 +0000 (21:26 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Wed, 26 Dec 2012 12:32:02 +0000 (21:32 +0900)
Retrieves the fully qualified path for the file
that contains the module.

Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/emulator.c

index 1ec568a4f0276eed7e50c753fe4a2b73494211e1..d12e75d76297c24bdf1ca284ad117964f9446db8 100644 (file)
@@ -310,6 +310,21 @@ static void parse_options(int argc, char *argv[], int *skin_argc,
 
 static void get_bin_dir(char *exec_argv)
 {
+    char *p = NULL;
+
+#ifdef CONFIG_WIN32
+    TCHAR szEXEPath[1024] = { 0, };
+    GetModuleFileName(NULL, szEXEPath, 1024);
+
+    p = strrchr(szEXEPath, '\\');
+    // TODO : null
+
+    strncpy(bin_dir, szEXEPath, strlen(szEXEPath) - strlen(p));
+
+    strcat(bin_dir, "\\");
+    return;
+#endif
+
     if (!exec_argv) {
         return;
     }
@@ -320,29 +335,16 @@ static void get_bin_dir(char *exec_argv)
         return;
     }
 
-    char *p = NULL;
-#ifdef _WIN32
-    p = strrchr(data, '\\');
-    if (!p) {
-        p = strrchr(data, '/');
-    }
-#else
     p = strrchr(data, '/');
-#endif
     if (!p) {
         free(data);
         return;
     }
 
     strncpy(bin_dir, data, strlen(data) - strlen(p));
-#ifdef _WIN32
-    strcat(bin_dir, "\\");
-#else
-    strcat(bin_dir, "/");
-#endif
 
+    strcat(bin_dir, "/");
     free(data);
-
 }
 
 char* get_bin_path(void) {