On Sun, Aug 3, 2014 at 4:20 PM, Thiago Macieira <[email protected]> wrote:
> On Sunday 03 August 2014 10:17:56 Miika Turkia wrote:
> > - QString filename = QDir::tempPath() + "/import-" +
> > QString::number(qrand() % 99999999) + ".dld";
> > + QString filename =
> > QDir::tempPath() + QDir::separator() + "import-" +
> QString::number(qrand()
> > % 99999999) + ".dld";
> > if (prepare_dives_for_divelogs(filename, selected)) {
> > QFile f(filename);
>
> This change is not necessary for the QFile opening on the last line and
> prepare_dives_for_divelogs does pass through QFile::encodeName but that
> itself
> isn't enough.
>
> We want prepare_dives_for_divelogs to do QDir::toNativeSeparators.
>
I might not be fully following you, but would this version be OK?
miika
From a2a9ba14641f995085e679216b42b83eae4eb799 Mon Sep 17 00:00:00 2001
From: Miika Turkia <[email protected]>
Date: Sun, 3 Aug 2014 20:22:48 +0300
Subject: [PATCH] Try to fix divelogs upload on Windows
zip_open needs correct directory separators. QFile::encodeName does not
do this conversion, so we must call it explicitly.
Signed-off-by: Miika Turkia <[email protected]>
---
qt-ui/subsurfacewebservices.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 565dc3f..6fa0b0a 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -124,7 +124,7 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
int error_code;
- zip = zip_open(QFile::encodeName(tempfile), ZIP_CREATE, &error_code);
+ zip = zip_open(QFile::encodeName(QDir::toNativeSeparators(tempfile)), ZIP_CREATE, &error_code);
if (!zip) {
char buffer[1024];
zip_error_to_str(buffer, sizeof buffer, error_code, errno);
--
1.9.1
_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface