From 7be8e903488ec7844583fd7d9d03b9166fa919e1 Mon Sep 17 00:00:00 2001 From: "giwoong.kim" Date: Wed, 26 Dec 2012 21:26:11 +0900 Subject: [PATCH] args: call GetModuleFileName on Windows Retrieves the fully qualified path for the file that contains the module. Signed-off-by: GiWoong Kim --- tizen/src/emulator.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 1ec568a..d12e75d 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -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) { -- 2.7.4