Skip to content

Commit

Permalink
fix osmsplit on windwos with fs::path
Browse files Browse the repository at this point in the history
  • Loading branch information
nickblock committed Jul 20, 2024
1 parent 3f2b8a3 commit e4a5a46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion osmsplit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ void processOSMFile(const fs::path &inputFileName, const fs::path &outDir,

numLocs = nodeLocatorStore.size();

fs::path pngFile = config->getFileName().string() + ".split.png";
fs::path pngFile =
outDir / config->getFileName().replace_extension(".split.png");

cout << "Writing out " << pngFile << std::endl;

Expand Down
14 changes: 10 additions & 4 deletions osmsplit/osmsplitwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ namespace GeoUtils {
OSMSplitWriter::LockWriter::LockWriter(fs::path outFilePath,
osmium::io::Header &header) {

int lastSlash = outFilePath.string().find(OSMSplitConfig::suffix().string());

mOutWayPath = outFilePath.parent_path();
mOutWayPath += string("_ways") + OSMSplitConfig::suffix().string();
auto filename = outFilePath.filename().string();
auto dotPos = filename.find(".");
auto basename = filename.substr(0, dotPos) + std::string("_ways");
auto dir = outFilePath.parent_path();
mOutWayPath =
dir / fs::path(basename).replace_extension(OSMSplitConfig::suffix());

mWayWriter = std::make_shared<osmium::io::Writer>(
osmium::io::File(mOutWayPath.string()), header,
Expand All @@ -29,6 +31,8 @@ OSMSplitWriter::LockWriter::LockWriter(fs::path outFilePath,
osmium::io::File(outFilePath.string()), header,
osmium::io::overwrite::allow);

std::cout << "LockWritert out " << outFilePath << std::endl;

mMutex = std::shared_ptr<std::mutex>(new std::mutex());
}
void OSMSplitWriter::LockWriter::write(osmium::memory::Buffer &buffer,
Expand Down Expand Up @@ -57,6 +61,8 @@ void OSMSplitWriter::LockWriter::putWays() {

mWriter = nullptr;

std::cout << "LockWritert way out " << mOutWayPath << std::endl;

fs::remove(mOutWayPath);
}

Expand Down

0 comments on commit e4a5a46

Please sign in to comment.