瀏覽代碼

Fix issue #8818 - escape quotes in the license file when using the DragNDrop cpack generator. Thanks to Clinton Stimpson for the patch.

David Cole 16 年之前
父節點
當前提交
a091e99cb9
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      Source/CPack/cmCPackDragNDropGenerator.cxx

+ 7 - 0
Source/CPack/cmCPackDragNDropGenerator.cxx

@@ -379,6 +379,13 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& toplevel,
       {
         std::string line;
         std::getline(ifs, line);
+        // escape quotes
+        std::string::size_type pos = line.find('\"');
+        while(pos != std::string::npos)
+        {
+          line.replace(pos, 1, "\\\"");
+          pos = line.find('\"', pos+2);
+        }
         osf << "        \"" << line << "\\n\"\n";
       }
       osf << "};\n";