From 662e765dc5d0f8fdd770714418d8cddb37a0b5e7 Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 23 Aug 2011 18:31:11 -0700 Subject: [PATCH] V0.9: For MinGW report an error if the two \\ are not found in the exe path We need to print a message and fail if the two \\ characters are not found in the executable path. --- vvp/main.cc | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/vvp/main.cc b/vvp/main.cc index a1b62d14e..370f9c2e6 100644 --- a/vvp/main.cc +++ b/vvp/main.cc @@ -243,18 +243,25 @@ int main(int argc, char*argv[]) so we chop the file name and the last directory by turning the last two \ characters to null. Then we append the lib\ivl$(suffix) to finish. */ - { char *s; - char basepath[4096], tmp[4096]; - GetModuleFileName(NULL, tmp, sizeof tmp); - /* Convert to a short name to remove any embedded spaces. */ - GetShortPathName(tmp, basepath, sizeof basepath); - s = strrchr(basepath, '\\'); - if (s) *s = 0; - s = strrchr(basepath, '\\'); - if (s) *s = 0; - strcat(s, "\\lib\\ivl" IVL_SUFFIX); - vpip_module_path[0] = strdup(basepath); + char *s; + char basepath[4096], tmp[4096]; + GetModuleFileName(NULL, tmp, sizeof tmp); + /* Convert to a short name to remove any embedded spaces. */ + GetShortPathName(tmp, basepath, sizeof basepath); + s = strrchr(basepath, '\\'); + if (s) *s = 0; + else { + fprintf(stderr, "%s: Missing first \\ in exe path!\n", argv[0]); + exit(1); } + s = strrchr(basepath, '\\'); + if (s) *s = 0; + else { + fprintf(stderr, "%s: Missing second \\ in exe path!\n", argv[0]); + exit(1); + } + strcat(s, "\\lib\\ivl" IVL_SUFFIX); + vpip_module_path[0] = strdup(basepath); #endif /* For non-interactive runs we do not want to run the interactive