Fix crossgen /createpdb when input filename is given without path (dotnet/coreclr...
authorJohn Chen <jochen@microsoft.com>
Wed, 18 May 2016 09:46:23 +0000 (02:46 -0700)
committerJan Kotas <jkotas@microsoft.com>
Wed, 18 May 2016 09:46:23 +0000 (02:46 -0700)
Fix a bug in "crossgen /createpdb" command that can cause it to fail
if the input filename is given without a path.

Commit migrated from https://github.com/dotnet/coreclr/commit/acd2bba2231e07f006846b44e790c5073d7c6019

src/coreclr/src/binder/applicationcontext.cpp

index 27f860e..e5c3025 100644 (file)
@@ -265,8 +265,17 @@ namespace BINDER_SPACE
             
             if (!fileName.FindBack(iSimpleNameStart, DIRECTORY_SEPARATOR_CHAR_W))
             {
+#ifdef CROSSGEN_COMPILE
+                iSimpleNameStart = fileName.Begin();
+#else
                 // Couldn't find a directory separator.  File must have been specified as a relative path.  Not allowed.
                 GO_WITH_HRESULT(E_INVALIDARG);
+#endif
+            }
+            else
+            {
+                // Advance past the directory separator to the first character of the file name
+                iSimpleNameStart++;
             }
 
             if (iSimpleNameStart == fileName.End())
@@ -274,9 +283,6 @@ namespace BINDER_SPACE
                 GO_WITH_HRESULT(E_INVALIDARG);
             }
 
-            // Advance past the directory separator to the first character of the file name
-            iSimpleNameStart++;
-            
             SString simpleName;
             bool isNativeImage = false;