mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-30 02:52:04 +08:00
C++ replay cache folder path / fix (#22396)
old-commit-hash: 4c7acf680cc29537ad73a51f8ce32253306cac15
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QEventLoop>
|
||||
#include <QFile>
|
||||
#include <QJsonArray>
|
||||
@@ -179,7 +178,7 @@ Segment::Segment(int n, const SegmentFile &segment_files, bool load_dcam, bool l
|
||||
static CURLGlobalInitializer curl_initializer;
|
||||
static std::once_flag once_flag;
|
||||
std::call_once(once_flag, [=]() {
|
||||
if (!QDir(CACHE_DIR).exists()) QDir().mkdir(CACHE_DIR);
|
||||
if (!CACHE_DIR.exists()) QDir().mkdir(CACHE_DIR.absolutePath());
|
||||
});
|
||||
|
||||
// fallback to qcamera/qlog
|
||||
@@ -253,5 +252,5 @@ QString Segment::localPath(const QUrl &url) {
|
||||
if (url.isLocalFile()) return url.toString();
|
||||
|
||||
QByteArray url_no_query = url.toString(QUrl::RemoveQuery).toUtf8();
|
||||
return CACHE_DIR + QString(QCryptographicHash::hash(url_no_query, QCryptographicHash::Sha256).toHex());
|
||||
return CACHE_DIR.filePath(QString(QCryptographicHash::hash(url_no_query, QCryptographicHash::Sha256).toHex()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDir>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
@@ -8,7 +9,7 @@
|
||||
#include "selfdrive/ui/replay/framereader.h"
|
||||
#include "selfdrive/ui/replay/logreader.h"
|
||||
|
||||
const QString CACHE_DIR = util::getenv("COMMA_CACHE", "/tmp/comma_download_cache/").c_str();
|
||||
const QDir CACHE_DIR(util::getenv("COMMA_CACHE", "/tmp/comma_download_cache/").c_str());
|
||||
const int connections_per_file = 3;
|
||||
|
||||
struct SegmentFile {
|
||||
|
||||
Reference in New Issue
Block a user