Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
0953865a
Commit
0953865a
authored
Mar 13, 2015
by
crashmatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mavlink-ftp : Fixed filepaths for upload
parent
00e14ded
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
QGCUASFileManager.cc
src/uas/QGCUASFileManager.cc
+5
-5
QGCUASFileView.cc
src/ui/QGCUASFileView.cc
+10
-4
No files found.
src/uas/QGCUASFileManager.cc
View file @
0953865a
...
@@ -475,16 +475,16 @@ void QGCUASFileManager::uploadPath(const QString& toPath, const QFileInfo& uploa
...
@@ -475,16 +475,16 @@ void QGCUASFileManager::uploadPath(const QString& toPath, const QFileInfo& uploa
}
}
QFile
file
(
uploadFile
.
absoluteFilePath
());
QFile
file
(
uploadFile
.
absoluteFilePath
());
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Truncate
))
{
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
))
{
_emitErrorMessage
(
tr
(
"Unable to open local file for upload (%1)"
).
arg
(
uploadFile
.
absoluteFilePath
()));
_emitErrorMessage
(
tr
(
"Unable to open local file for upload (%1)"
).
arg
(
uploadFile
.
absoluteFilePath
()));
return
;
return
;
}
}
_writeFileAccumulator
=
file
.
readAll
();
_writeFileAccumulator
=
file
.
readAll
();
qint64
bytesRead
=
file
.
write
((
const
char
*
)
_readFileAccumulator
,
_readFileAccumulator
.
length
());
if
(
bytesRead
<=
0
)
{
file
.
close
();
file
.
close
();
if
(
_writeFileAccumulator
.
size
()
==
0
)
{
_emitErrorMessage
(
tr
(
"Unable to read data from local file (%1)"
).
arg
(
uploadFile
.
absoluteFilePath
()));
_emitErrorMessage
(
tr
(
"Unable to read data from local file (%1)"
).
arg
(
uploadFile
.
absoluteFilePath
()));
return
;
return
;
}
}
...
@@ -495,7 +495,7 @@ void QGCUASFileManager::uploadPath(const QString& toPath, const QFileInfo& uploa
...
@@ -495,7 +495,7 @@ void QGCUASFileManager::uploadPath(const QString& toPath, const QFileInfo& uploa
request
.
hdr
.
session
=
0
;
request
.
hdr
.
session
=
0
;
request
.
hdr
.
opcode
=
kCmdCreateFile
;
request
.
hdr
.
opcode
=
kCmdCreateFile
;
request
.
hdr
.
offset
=
0
;
request
.
hdr
.
offset
=
0
;
request
.
hdr
.
size
=
bytesRead
;
request
.
hdr
.
size
=
0
;
_fillRequestWithString
(
&
request
,
toPath
);
_fillRequestWithString
(
&
request
,
toPath
);
_sendRequest
(
&
request
);
_sendRequest
(
&
request
);
}
}
...
...
src/ui/QGCUASFileView.cc
View file @
0953865a
...
@@ -100,19 +100,25 @@ void QGCUASFileView::_uploadFile(void)
...
@@ -100,19 +100,25 @@ void QGCUASFileView::_uploadFile(void)
_ui
.
statusText
->
clear
();
_ui
.
statusText
->
clear
();
// And now download to this location
// get and check directory from list view
QString
path
;
QTreeWidgetItem
*
item
=
_ui
.
treeWidget
->
currentItem
();
QTreeWidgetItem
*
item
=
_ui
.
treeWidget
->
currentItem
();
if
(
item
&&
item
->
type
()
!=
_typeDir
)
{
if
(
item
&&
item
->
type
()
!=
_typeDir
)
{
return
;
return
;
}
}
QString
targetDir
=
item
->
text
(
0
);
// Find complete path for upload directory
QString
path
;
do
{
QString
name
=
item
->
text
(
0
).
split
(
"
\t
"
)[
0
];
// Strip off file sizes
path
.
prepend
(
"/"
+
name
);
item
=
item
->
parent
();
}
while
(
item
);
qDebug
()
<<
"Upload: "
<<
path
;
QString
uploadFromHere
=
QGCFileDialog
::
getOpenFileName
(
this
,
tr
(
"Upload File"
),
QString
uploadFromHere
=
QGCFileDialog
::
getOpenFileName
(
this
,
tr
(
"Upload File"
),
QDir
::
homePath
());
QDir
::
homePath
());
_manager
->
uploadPath
(
targetDir
,
uploadFromHere
);
_manager
->
uploadPath
(
path
,
uploadFromHere
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment