[PATCH] D13536: Fixed sys::findProgramByName (Windows) to accept files with point in name
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 8 09:05:21 PDT 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL249696: Windows: Fixed sys::findProgramByName to work with files containing dot in… (authored by grimar).
Changed prior to commit:
http://reviews.llvm.org/D13536?vs=36841&id=36862#toc
Repository:
rL LLVM
http://reviews.llvm.org/D13536
Files:
llvm/trunk/lib/Support/Windows/Program.inc
Index: llvm/trunk/lib/Support/Windows/Program.inc
===================================================================
--- llvm/trunk/lib/Support/Windows/Program.inc
+++ llvm/trunk/lib/Support/Windows/Program.inc
@@ -75,8 +75,15 @@
do {
U16Result.reserve(Len);
- Len = ::SearchPathW(Path, c_str(U16Name),
- U16Ext.empty() ? nullptr : c_str(U16Ext),
+ // Lets attach the extension manually. That is needed for files
+ // with a point in name like aaa.bbb. SearchPathW will not add extension
+ // from its argument to such files because it thinks they already had one.
+ SmallVector<wchar_t, MAX_PATH> U16NameExt;
+ if (std::error_code EC =
+ windows::UTF8ToUTF16(Twine(Name + Ext).str(), U16NameExt))
+ return EC;
+
+ Len = ::SearchPathW(Path, c_str(U16NameExt), nullptr,
U16Result.capacity(), U16Result.data(), nullptr);
} while (Len > U16Result.capacity());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13536.36862.patch
Type: text/x-patch
Size: 986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151008/85a7226f/attachment.bin>
More information about the llvm-commits
mailing list