Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-03-23 19:02:25 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-03-23 19:02:25 (GMT)
commitda7606e6816706322d03cb417111597f268e686e (patch)
tree478a40bd5533770bc2ab20cba0a3e71e380c1842 /lib
parentaa8debb4cb500e526107e05c269d231ac54492ff (diff)
Fix conversion from uri to file
Diffstat (limited to 'lib')
-rw-r--r--lib/src/GeckoDownload.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/src/GeckoDownload.cpp b/lib/src/GeckoDownload.cpp
index eb6b4f4..134e1de 100644
--- a/lib/src/GeckoDownload.cpp
+++ b/lib/src/GeckoDownload.cpp
@@ -1,6 +1,8 @@
#include "config.h"
#include <nsIFactory.h>
+#include <nsIFile.h>
+#include <nsIFileURL.h>
#include "sugar-download-manager.h"
@@ -46,13 +48,20 @@ GeckoDownload::Init (nsIURI *aSource,
nsILocalFile *aTempFile,
nsICancelable *aCancelable)
{
- mSource = aSource;
- aTarget->GetPath (mTargetFileName);
- mMIMEInfo = aMIMEInfo;
- mTempFile = aTempFile;
-// mCancelable = aCancelable; Just a reminder for when we implement cancelling downloads.
+ mSource = aSource;
+ mMIMEInfo = aMIMEInfo;
+ mTempFile = aTempFile;
- return NS_OK;
+ nsresult rv;
+
+ nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aTarget);
+ NS_ENSURE_TRUE(fileURL, NS_ERROR_FAILURE);
+
+ nsCOMPtr<nsIFile> file;
+ rv = fileURL->GetFile(getter_AddRefs(file));
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+
+ file->GetNativePath (mTargetFileName);
}
NS_IMETHODIMP