fxing temp dir on windows

This commit is contained in:
matlabbe
2026-05-29 10:15:33 -07:00
parent d9ef6ad231
commit bcd39ab2e9
11 changed files with 78 additions and 62 deletions
+3 -10
View File
@@ -17,18 +17,13 @@
#include <rtabmap/utilite/UConversion.h>
#include <rtabmap/utilite/UFile.h>
#include "TestUtils.h"
#include <opencv2/core.hpp>
#include <fstream>
#include <memory>
#include <string>
#ifdef _WIN32
#include <process.h>
#define getpid _getpid
#else
#include <unistd.h>
#endif
using namespace rtabmap;
@@ -49,8 +44,7 @@ namespace {
// reloads fresh content on each TEST().
std::string writeStubScript(int tag)
{
const std::string path = uFormat(
"/tmp/rtabmap_test_pymatcher_%d_%d.py", getpid(), tag);
const std::string path = test::tempPath(uFormat("rtabmap_test_pymatcher_%d_%d.py", test::getPid(), tag));
std::ofstream out(path);
out <<
"import numpy as np\n"
@@ -168,8 +162,7 @@ TEST(PyMatcher, AsymmetricCounts)
// then short-circuits because pModule_ is null.
TEST(PyMatcher, MissingPathReturnsEmpty)
{
const std::string scriptPath = uFormat(
"/tmp/rtabmap_test_pymatcher_does_not_exist_%d.py", getpid());
const std::string scriptPath = test::tempPath(uFormat("rtabmap_test_pymatcher_does_not_exist_%d.py", test::getPid()));
PyMatcher matcher(scriptPath, 0.2f, 20, false, "indoor");
cv::Mat descFrom = makeDescriptors(2, 8);