From 112c2724528a67148520c24983f0c8f2544f433e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 1 Nov 2010 17:19:39 +0000 Subject: [PATCH] From John Ivar Haugland & Robert Osfield, fix for bug in VisualStudio where it adds an redundent '/n' on the end of the command line arguments for no reason. --- src/osg/ArgumentParser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/osg/ArgumentParser.cpp b/src/osg/ArgumentParser.cpp index 7d18693b5..475caec52 100644 --- a/src/osg/ArgumentParser.cpp +++ b/src/osg/ArgumentParser.cpp @@ -197,6 +197,16 @@ ArgumentParser::ArgumentParser(int* argc,char **argv): } } #endif + +#ifdef WIN32 + // Remove linefeed from last argument if it exist + char* lastline = argc==0 ? 0 : _argv[*argc-1]; + if (lastline) + { + int len = strlen(lastline); + if (len>0 && lastline[len-1] == '\n') lastline[len-1]= '\0'; + } +#endif } std::string ArgumentParser::getApplicationName() const