Handle MAX_PATH every where

This commit is contained in:
2025-01-26 15:54:28 +01:00
parent fc36024eee
commit 0ff2001797
4 changed files with 40 additions and 11 deletions
+22 -5
View File
@@ -15,8 +15,23 @@
#include "starfit.h"
#include <lcms2.h>
QString makeMaxPath(QString path)
{
#ifdef Q_OS_WIN64
if(!path.startsWith("\\\\?\\"))
{
QFileInfo info(path);
path = info.absoluteFilePath();
path = QDir::toNativeSeparators(path);
path.prepend("\\\\?\\");
qDebug() << path;
}
#endif
return path;
}
LoadRunable::LoadRunable(const QString &file, Image *receiver, AnalyzeLevel level, bool thumbnail) :
m_file(file),
m_file(makeMaxPath(file)),
m_receiver(receiver),
m_analyzeLevel(level),
m_thumbnail(thumbnail)
@@ -451,7 +466,8 @@ bool readFITSHeader(const QString &path, ImageInfoData &info)
{
fitsfile *fr;
int status = 0;
fits_open_diskfile(&fr, path.toLocal8Bit().data(), READONLY, &status);
QString path2 = makeMaxPath(path);
fits_open_diskfile(&fr, path2.toLocal8Bit().data(), READONLY, &status);
if(fr && status == 0)
{
@@ -463,10 +479,11 @@ bool readFITSHeader(const QString &path, ImageInfoData &info)
bool readXISFHeader(const QString &path, ImageInfoData &info)
{
QString path2 = makeMaxPath(path);
try
{
LibXISF::XISFReader xisf;
xisf.open(path.toLocal8Bit().data());
xisf.open(path2.toLocal8Bit().data());
const LibXISF::Image &image = xisf.getImage(0, false);
auto fitskeywords = image.fitsKeywords();
@@ -532,8 +549,8 @@ bool loadImage(const QString &path, ImageInfoData &info, std::shared_ptr<RawImag
}
ConvertRunable::ConvertRunable(const QString &in, const QString &out, const QString &format, const ConvertParams &params, QSemaphore *semaphore) :
m_infile(in),
m_outfile(out),
m_infile(makeMaxPath(in)),
m_outfile(makeMaxPath(out)),
m_format(format),
m_params(params),
m_semaphore(semaphore)