mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 812412 - replace full path with leaf name only, r=dougt
This commit is contained in:
parent
3d1f39fe89
commit
56866e71cd
@ -23,6 +23,7 @@
|
||||
#include "nsIFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsLocalFile.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#define TARGET_FOLDER "/sdcard/downloads/bluetooth/"
|
||||
@ -276,14 +277,22 @@ BluetoothOppManager::SendFile(BlobParent* aActor)
|
||||
/*
|
||||
* Process of sending a file:
|
||||
* - Keep blob because OPP connection has not been established yet.
|
||||
* - Try to retrieve file name from the blob or assign one if failed to get.
|
||||
* - Create an OPP connection by SendConnectRequest()
|
||||
* - After receiving the response, start to read file and send.
|
||||
*/
|
||||
mBlob = aActor->GetBlob();
|
||||
|
||||
nsCOMPtr<nsIDOMFile> file = do_QueryInterface(mBlob);
|
||||
if (file) {
|
||||
file->GetName(sFileName);
|
||||
nsCOMPtr<nsIDOMFile> domFile = do_QueryInterface(mBlob);
|
||||
nsString fullPath;
|
||||
|
||||
if (domFile && NS_SUCCEEDED(domFile->GetMozFullPathInternal(fullPath))) {
|
||||
nsCOMPtr<nsIFile> localFile = new nsLocalFile();
|
||||
NS_NewLocalFile(fullPath, false, getter_AddRefs(localFile));
|
||||
|
||||
if (localFile) {
|
||||
localFile->GetLeafName(sFileName);
|
||||
}
|
||||
}
|
||||
|
||||
if (sFileName.IsEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user