@@ -633,6 +633,9 @@ namespace attributes {
633
633
// if it wasn't (throws exception on io error)
634
634
bool commit (const std::string& preamble = std::string());
635
635
636
+ // Convert a dot in package name to underscore for use in header file name
637
+ std::string dotNameHelper (const std::string & name) const ;
638
+
636
639
private:
637
640
638
641
// Private virtual for doWriteFunctions so the base class
@@ -717,7 +720,7 @@ namespace attributes {
717
720
std::string includeDir_;
718
721
};
719
722
720
- // Class which manages generating PackageName_RcppExports .h header file
723
+ // Class which manages generating PackageName .h header file
721
724
class CppPackageIncludeGenerator : public ExportsGenerator {
722
725
public:
723
726
CppPackageIncludeGenerator (const std::string& packageDir,
@@ -1894,6 +1897,13 @@ namespace attributes {
1894
1897
return removeFile (targetFile_);
1895
1898
}
1896
1899
1900
+ // Convert a possible dot in package name to underscore as needed for header file
1901
+ std::string ExportsGenerator::dotNameHelper (const std::string & name) const {
1902
+ std::string newname (name);
1903
+ std::replace (newname.begin (), newname.end (), ' .' , ' _' );
1904
+ return newname;
1905
+ }
1906
+
1897
1907
CppExportsGenerator::CppExportsGenerator (const std::string& packageDir,
1898
1908
const std::string& package,
1899
1909
const std::string& fileSep)
@@ -2128,7 +2138,7 @@ namespace attributes {
2128
2138
const std::string& fileSep)
2129
2139
: ExportsGenerator(
2130
2140
packageDir + fileSep + " inst" + fileSep + " include" +
2131
- fileSep + package + kRcppExportsSuffix ,
2141
+ fileSep + dotNameHelper( package) + kRcppExportsSuffix,
2132
2142
package,
2133
2143
"// ")
2134
2144
{
@@ -2346,7 +2356,7 @@ namespace attributes {
2346
2356
const std::string& fileSep)
2347
2357
: ExportsGenerator(
2348
2358
packageDir + fileSep + " inst" + fileSep + " include" +
2349
- fileSep + package + " .h" ,
2359
+ fileSep + dotNameHelper( package) + ".h",
2350
2360
package,
2351
2361
"// ")
2352
2362
{
@@ -2359,7 +2369,6 @@ namespace attributes {
2359
2369
std::string guard = getHeaderGuard (); // #nocov start
2360
2370
ostr () << " #ifndef " << guard << std::endl;
2361
2371
ostr () << " #define " << guard << std::endl << std::endl;
2362
-
2363
2372
ostr () << " #include \" " << packageCpp () << kRcppExportsSuffix
2364
2373
<< " \" " << std::endl;
2365
2374
0 commit comments